Despite Jeff Qiu's best efforts to avoid procrastinating, he still has yet to study for tomorrow's exam! Fortunately, his classmates are very resourceful and have taken notes during class.
In order to get his classmates to share them, he has decided to befriend some of the classmates. Some classmates are more attentive in class and therefore are able to provide more notes. His class contains
Initially, the only friend each classmate has is themselves. Jeff will then provide you with
1 a b
which means to make classmates a
and b
friends with each other. Note that friendship is bidirectional.
2 a
which means to print the size of a
's friend list.
3 a
which means to print the resourcefulness of classmate a
's friend list.
Constraints
For all subtasks:
Subtask 1 [15%]
Subtask 2 [85%]
No additional constraints.
Input Specification
The first line will consist of the two integers
The next line will have
The next
Output Specification
For each query of type 2
or 3
, print out the answer in a new line.
Sample Input
4 5
1 2 1 0
1 1 2
1 1 3
2 1
2 3
3 3
Sample Output
3
3
4
Explanation
1
is friends with 2
and 3
, so both 1
and 3
have three friends. Therefore, the resourcefulness of 3
is
Comments
Are you friend with yourself?