Codeforces Round 266 (Div. 2) |
---|
Finished |
There are n employees working in company "X" (let's number them from 1 to n for convenience). Initially the employees didn't have any relationships among each other. On each of m next days one of the following events took place:
Your task is to write a program that will, given the events, answer the queries of the described type. At that, it is guaranteed that throughout the whole working time the company didn't have cyclic dependencies.
The first line contains two integers n and m (1 ≤ n, m ≤ 105) — the number of employees and the number of events.
Each of the next m lines contains the description of one event (the events are given in the chronological order). The first number of the line determines the type of event t (1 ≤ t ≤ 3).
It is guaranteed that the input has at least one query of the third type.
For each query of the third type print "YES" if the employee signed the document package and "NO" otherwise. Print all the words without the quotes.
4 9
1 4 3
2 4
3 3 1
1 2 3
2 2
3 1 2
1 3 1
2 2
3 1 3
YES
NO
YES
Name |
---|