Implement disjont sets union data structure. You have to perform queries of two types:
union u v - unite two sets that contain u and v respectively;
get u v - check that two elements u and v belong to the same set.
The first line contains two integers n and m (1 ≤ n, m ≤ 5 * 10^5
) - the number of elements and the number of queries. Next m lines contain queries, one per line.
For a query union the line looks like union u v (1 ≤ u, v ≤ n).
For a query get the line looks like get u v (1 ≤ u, v ≤ n).
Print the result of each query get one per line in the respected order: "YES", if the elements belong to the same set, and "NO" otherwise.