Devide n vertical into 2 group A and B.
There are q query of two type: 1 u v, tell you that u and v belong to different group; 2 u v, print "YES" if u and v belong to one group, "NO" if u and v not be long to one group, "NOT GIVEN" if there is not enough information about u and v, based on the information has given in query type 1;
For example: Input: 3 5 2 1 2 1 1 2 2 1 2 1 2 3 2 1 3 Output: NOT GIVEN NO YES I have stucked in this problem for a week, please help me ToT.