-----Input-----
The first line of input consists of two integers $N$ and $Q$, where $1 \le N \le 1000000$ is the number of elements in the base set and $0 \le Q \le 1000000$ is the number of operations. Then follow $Q$ lines, one per operation. There are two types of operations:
 - “= $a$ $b$” indicate that the sets containing $a$ and $b$ are joined
 - “? $a$ $b$” is a query asking whether $a$ and $b$ belong to the same set

In both cases, $a$ and $b$ are distinct integers between $0$ and $N-1$.

-----Output-----
For each query output a line containing “yes” if $a$ and $b$ are in the same set, and “no” otherwise.

-----Examples-----
Sample Input:
10 4
? 1 3
= 1 8
= 3 8
? 1 3
Sample Output:
no
yes

Difficulty: competition

Starter code:

Solutions: