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:
-
either employee y became the boss of employee x (at that, employee x didn't have a boss before);
-
or employee x gets a packet of documents and signs them; then he gives the packet to his boss. The boss signs the documents and gives them to his boss and so on (the last person to sign the documents sends them to the archive);
-
or comes a request of type "determine whether employee x signs certain documents".
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.
Output
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.