Uneori îmi spun: am să mor
atât de singuratecă-n mijlocul lor;
limba simplă a bucuriilor n-am învâțat;
am să mor ca o pasăre care prea mult a zburat,
dar n-a făcut cuib nicăieri.
― Oamenii ma uimesc, Magda Isafost
As of writing the informal statement, the winter just came and the statement was in season. Now, it is not winter anymore, so here is the formal statement instead:
You are given a connected graph with
nodes and edges. You are givenqueries of the following types:
- is currently frozen.
Initially, no node is frozen.
The graph has the following property:
- If, at time
- become frozen.
For each query of type
, answer whether the node is currently frozen.
Note:
- If a node is already frozen, it remains unaffected after a type
- .
Input Format
- The first line of input contains three integers
If is or , it indicates that you must effectuate an update of the type with parameter . Otherwise, answer the query with parameter
Output Format
For each query of type
, print if the queried node is frozen. Otherwise, print.
You may print each character of the string in uppercase or lowercase (for example, the strings
, , andwill all be treated as identical).
Constraints
- .
Subtasks
- Subtask 1 (10 points):
- .
- Subtask 2 (30 points): Each node in the given graph has at most two neighbours.
- Subtask 3 (60 points): Original constraints.
Sample Input 1
6 6 6
1 2
2 3
4 1
5 4
6 1
6 5
1 1
3 1
1 5
2 1
3 4
3 3
Sample Output 1
YES
YES
NO
Explanation
Test Case
: The graph looks like:
- Query
After second, all the neighbours of node , i.e., nodes and , and all the neighbours of node , i.e., nodes and are frozen.
Thus, after this query, the frozen nodes in the graph are and
ConversionConversion EmoticonEmoticon