People connect with each other in a social network. A connection between Person and Person is represented as . When two persons belonging to different communities connect, the net effect is the merge the communities which and belong to.
At the beginning, there are people representing communities. Suppose person and connected and later and connected, then ,, and will belong to the same community.
There are two types of queries:
communities containing persons and are merged if they belong to different communities.
print the size of the community to which person belongs.
Input Format
The first line of input contains 2 space-separated integers and , the number of people and the number of queries.
The next lines will contain the queries.
Constraints
Output Format
The output of the queries.
Sample Input
STDIN Function ----- -------- 3 6 n = 3, q = 6 Q 1 print the size of the community containing person 1 M 1 2 merge the communities containing persons 1 and 2 ... Q 2 M 2 3 Q 3 Q 2
Sample Output
1
2
3
3
Explanation
Initial size of each of the community is .