Union-Find

Input

The first line of input consists of two integers
$N$ and $Q$, where $1 \le N \le 1\, 000\, 000$ is the
number of elements in the base set and $0 \le Q \le 1\, 000\, 000$ 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.