Traian recently celebrated his birthday and received a graph with nodes as a gift. Initially, each node was in its own connected component. But then, Traian's dog came and asked him questions of the following type:
- : Add edges to your graph as
- : Tell if nodes and are in the same connected component.
Task
Answer Traian's dog's questions.
Input data
The first line of the input contains and , representing the number of nodes in the graph and the number of questions, respectively. The next lines contain three numbers , where represents the type of the question, and and are two nodes in the graph.
Output data
For each question of type , output the answer on a new line. The answer can be either Da
or Nu
(Da
for yes and Nu
for no in Romanian), depending on the result.
Constraints and clarifications
- If an edge has already been added in a question of type , Traian will not add it again.
- For questions of type , it is not guaranteed that .
# | Score | Constraints |
---|---|---|
1 | 10 | |
2 | 10 | |
3 | 10 | |
4 | 20 | |
5 | 50 | No additional constraints |
Example
stdin
7 6
1 4 7
2 5 3
1 3 6
1 6 7
2 7 1
2 3 4
stdout
Nu
Nu
Da
Explanation
After the first question, the graph will look like this:
The answer to the second question is no, because nodes and are not in the same connected component.
After the third question, the graph will look like this:
After the fourth question, the graph will look like this:
The answer to the fifth question is no, because nodes and are not in the same connected component.
The answer to the sixth question is yes, because nodes and are in the same connected component.