C. Connected Components Strikes Again
time limit per test
1.5 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output

There are $$$n$$$ islands laid out on a circle. An agency is responsible for the control of a set of $$$m$$$ bidirectional bridges, numbered from $$$0$$$ to $$$m-1$$$, that are located on the center of the islands and can join any two pair of them. The agency might need to restrict traffic on some bridges in case that maintenance is needed to ensure safety of everyone who crosses it. When that happens, the agency select a subset of bridges to be free for crossing. Besides that, it is needed to know if it is possible to go from one given island $$$a$$$ to another island $$$b$$$ using only those bridges, so that the population can plan their trips accordingly.

The agency must process $$$q$$$ queries, which have four types:

  • 1 $$$l$$$ $$$r$$$  — make only bridges from the interval $$$[l, r]$$$ free to be crossed.
  • 2 $$$l$$$ $$$r$$$  — make all bridges free to be crossed, except those that belong to the interval $$$[l, r]$$$. Note that here, bridges belonging to the interval $$$[l, r]$$$ will go under maintenance, while the ones outside it will become free to be crossed, even the ones who were previously under maintenance.
  • 3 $$$x$$$ $$$u$$$ $$$v$$$  — change the $$$x$$$-th bridge, so that it connect the islands $$$u$$$ and $$$v$$$.
  • 4 $$$u$$$ $$$v$$$  — check if there exists a path between islands $$$u$$$ and $$$v$$$ using only bridges that are not under maintenance.

At the beginning, all bridges are free.

Latache, a student at CIn, while doing his internship at this agency, he received the task of creating a program capable of quickly processing the given queries. However, since Latache was called for so many internships, he didn't have enough time to complete the task before going to work on a different country. But Latache knows how good you are at programming, so you must help him and not let him down (otherwise, he won't help you get interviews).

Input

The first line contain $$$3$$$ integers $$$n$$$, $$$m$$$ and $$$q$$$ $$$(2 \le n \le 250, 1 \le m \le 10^5, 1 \le q \le 2 \cdot 10^4)$$$.

Then, $$$m$$$ lines follow, containing a pair of numbers $$$a_i$$$, $$$b_i$$$ $$$(0 \le a_i, b_i < n, a_i \neq b_i)$$$, indicating the pair of islands connected by the $$$i$$$-th bridge.

Finally, we have $$$q$$$ more lines: the requisitions, according to the description given on the statement, with the following restrictions:

$$$0 \le l \le r < m$$$

$$$0 \le x < m$$$

$$$0 \le u, v < n, u \neq v$$$

Output

Your program must output, after each query of types 1, 2 and 3, the number of connected components on the graph formed by the islands and bridges, considering only the bridges that are not under maintenance.

For queries of type 4, output "YES" or "NO" (without quotes).

Example
Input
6 5 5
0 1
1 2
5 4
4 5
5 4
1 0 4
4 5 4
4 5 2
3 2 1 3
3 4 1 4
Output
3
YES
NO
2
1