It’s universally acknowledged that there’re innumerable trees in the campus of HUST. Thus a professional tree manager is needed. Your task is to write a program to help manage the trees. Initially, there are n forests and for the i-th forest there is only the i-th tree in it. Given four kinds of operations. 1 u v, merge the forest containing the u-th tree and the forest containing the v-th tree; 2 u, separate the u-th tree from its forest; 3 u, query the size of the forest which contains the u-th tree; 4 u v, query whether the u-th tree and the v-th tree are in the same forest.
It’s universally acknowledged that there’re innumerable trees in the campus of HUST. Thus a professional tree manager is needed. Your task is to write a program to help manage the trees. Initially, there are n forests and for the i-th forest there is only the i-th tree in it. Given four kinds of operations. 1 u v, merge the forest containing the u-th tree and the forest containing the v-th tree; 2 u, separate the u-th tree from its forest; 3 u, query the size of the forest which contains the u-th tree; 4 u v, query whether the u-th tree and the v-th tree are in the same forest.
