Friends Two


There are nn people in a class, numbered 11 through nn. Friendship is mutual: if aa is friends with bb, then bb is friends with aa. Two people are in the same friend group if they are the same person, or if they are connected by a chain of friendships (friends, friends of friends, and so on).

At the start of the year, some friendships exist. Over the year, those friendships break one by one until none remain. You are given a chronological log of qq events. Every friendship that ever existed appears in this log as a breakup, so the initial friendships are exactly the pairs that later break.

Process the events in order and answer queries about who is still in the same friend group.

Input

The first line contains two integers nn and qq, the number of people and the number of events.

The next qq lines each describe one event in one of the following forms:

  • 1 a b — the friendship between aa and bb breaks (and is removed). If that friendship is already gone, nothing happens.
  • 2 a b — ask whether aa and bb are currently in the same friend group.

Output

For each event of type 22, output one line:

  • Yes if aa and bb are in the same friend group,
  • No otherwise.

Constraints

  • 1≤n≤1051 \le n \le 10^5
  • 1≤q≤5×1051 \le q \le 5 \times 10^5
  • 1≤a,b≤n1 \le a, b \le n
  • a≠ba \ne b

Example 1

Input 1
5 10
1 1 2
1 4 5
2 3 4
1 3 4
1 2 5
2 2 5
2 2 5
1 3 5
2 2 4
1 1 5
Output 1
Yes
No
No
No
Explanation

The breakups in the log are the pairs (1,2)(1, 2), (4,5)(4, 5), (3,4)(3, 4), (2,5)(2, 5), (3,5)(3, 5), and (1,5)(1, 5), so those six friendships exist at the start.

  • After (1,2)(1, 2) and (4,5)(4, 5) break, 33 and 44 are still friends directly, so the answer is Yes.
  • After (3,4)(3, 4) and (2,5)(2, 5) also break, 22 and 55 are no longer connected, so both queries answer No.
  • After (3,5)(3, 5) breaks, 22 and 44 are still not connected, so the answer is No.

Example 2

Input 2
10 20
2 3 9
2 6 10
1 3 10
2 4 8
1 1 9
1 2 8
2 6 10
2 4 8
1 2 9
1 6 10
1 5 8
1 2 8
1 5 6
2 7 9
1 8 10
2 7 9
2 2 4
1 3 5
1 5 8
2 1 8
Output 2
Yes
Yes
No
Yes
No
No
No
No
No

Comments0


No comments yet

Be the first to comment.

New comment


Log in to join the discussion.