State Roads
In the Middle Ages, the region known as Bytelandia was divided into several states, with borders that frequently shifted. As a result, major cities often changed from one state to another. Today, historians are attempting to reconstruct the configuration of these states at various points in time.
One method they use involves analyzing chronicles that mention the status of roads connecting cities. If a road is recorded as a state road at a particular time, historians conclude that the cities it connects were definitely part of the same state at that moment. However, local roads, which are not mentioned in the chronicles, were also used for travel. Therefore, it is incorrect to assume that every pair of cities within a state was connected by a state road, or that travel between any two cities in the same state was possible solely via state roads.
To support this research, historians require a system that can track the status of roads over time and answer queries about whether a specified group of cities could have formed a single state at a given moment.
Input
The first line of input contains two integers, n and q (1 ≤ n ≤ 1000000, 1 ≤ q ≤ 2000000), representing the number of cities in medieval Bytelandia and the number of events (chronicle entries and queries). Cities are numbered consecutively from 1 to n.
Following this are the events and queries, listed in chronological order (a query pertains to the time when all preceding events have occurred, but none of the subsequent events have). Each of the q lines describes an event or query in one of the following formats:
"1 u v" (first type of event) indicates that the road between cities u and v has been designated as a state road (1 ≤ u < v ≤ n);
"2 m" (second type of event) indicates that the road, which was designated as a state road due to the m-th first-type event, has lost this status (m can range from 1 to the number of first-type events that occurred before this one);
"3 k u_1 u_2 ... u_k" - query: could there have been a state at the current moment, consisting of exactly k cities numbered {u_1, u_2, ..., u_k} (1 ≤ k ≤ n, 1 ≤ u_1 < u_2 < ... < u_k ≤ n).
All roads mentioned in the chronicles are bidirectional, and no two different cities are connected by more than one road.
Initially, before any queries, no road has the status of a state road. A road's status can change from state to ordinary and back any number of times. It is guaranteed that each m will appear in second-type events no more than once. The sum of all values of k does not exceed 2000000.
Output
For each query, output "YES" on a separate line if the specified list of cities could have been the complete list of cities in a state at that time, and "NO" otherwise.