The problem is:
10 Kinds of People in kattis (https://tamu.kattis.com/problems/10kindsofpeople)
I used disjoint set, which seems to be the best ap