10583 - Ubiquitous Religions


Difficulty : easy

Solution Description :

Simple union-find problem

Just run union-find for each pair
and at last print the number of root or parent or sub-set or disjoint set