Initially, each integer from $0$ through $n$ belongs to its own separate set. In other words, the initial sets are $\{0\}, \{1\}, \{2\}, \dots, \{n\}$.
You must process two kinds of operations. One operation merges the sets containing two given elements, and the other checks whether two given elements are in the same set.
Write a program that processes all operations in order.
The first line contains two integers $n$ and $m$. Here, $m$ is the number of operations to process.
Each of the next $m$ lines contains one operation.
0 a b: merge the set containing $a$ and the set containing $b$.1 a b: check whether $a$ and $b$ belong to the same set.For each operation of the form 1 a b, print YES if $a$ and $b$ are in the same set, and NO otherwise. Print each answer on its own line.