CHM#1884

CHM

2 seconds
256 megabytes
Easy

Your task is to implement a Persistent Disjoint-Set-Union. What does this mean?

About Disjoint-Set-Union:

Initially, you have elements. You need to be able to respond to types of queries:

About Persistent:

Now, there will be several versions of the Disjoint-Set-Union data structure.

Queries will look like this:

Input

The first line contains two integers (1 \leq N \leq 10^5) and (0 \leq K \leq 10^5) — the number of elements and the number of queries. Initially, all elements are in different sets. This initial version of the structure has number .

Then follow lines, each containing the description of a query as described above. Queries are numbered from to .

When processing the -th query of the form , the new version gets the number .

There will be no queries to non-existent versions (j > i).

Output

For each query of the form , output YES or NO on a separate line.

Examples

Example 1

Loading
Loading