DSU2#9013

DSU2

1 secondo
64 megabyte
Facile

In Uzhlandia, there are cities numbered from to . Currently, there are no roads, but over time, roads will be constructed. Additionally, Uzhlandia plans to build premium roads, which have better asphalt and traffic conditions but require a toll.

Tourist Vasyl has asked you to process queries of three types:

  1. 1 a b — Establish a two-way road between cities and .

  2. 2 a b — Establish a two-way premium road between cities and .

  3. 3 a b — Determine if it is possible to travel from city to city :

    • If it is possible using only premium roads, output "$$$".

    • If it is possible using any roads, output "YES".

    • If it is not possible at all, output "NO".

Input

The first line contains two integers and (1 \le n, q \le 3 \times 10^5).

The next lines describe the queries in the format given above.

Output

For each query of the third type, output the answer on a separate line.

Esempi

Esempio 1

Loading
Loading