You are given an undirected graph with $$$n$$$ vertices numbered from $$$1$$$ to $$$n$$$. Initially there are no edges.
You are asked to perform some queries on the graph. Let $$$last$$$ be the answer to the latest query of the second type, it is set to $$$0$$$ before the first such query. Then the queries are the following:
Good luck!
The first line contains two integer numbers $$$n$$$ and $$$m$$$ ($$$2 \le n, m \le 2 \cdot 10^5$$$) — the number of vertices and the number of queries, respectively.
Each of the following $$$m$$$ lines contains a query of one of two aforementioned types. It is guaranteed that there is at least one query of the second type.
Print a string, consisting of characters '0' and '1'. The $$$i$$$-th character should be the answer to the $$$i$$$-th query of the second type. Therefore the length of the string should be equal to the number of queries of the second type.
5 9 1 1 2 1 1 3 2 3 2 1 2 4 2 3 4 1 2 4 2 3 4 1 1 3 2 4 3
1010
3 9 1 1 2 1 2 3 1 3 1 2 1 3 1 3 2 2 2 3 1 1 2 2 1 2 2 1 2
1101
The converted queries in the first example are:
The converted queries in the second example are:
Name |
---|