#P10942. [2015杭电多校]Undirected Graph
[2015杭电多校]Undirected Graph
Undirected Graph
Problem Description
As we know, Rikka is poor at math. Yuta is worrying about this situation, so he gives Rikka some math tasks to practice. There is one of them: There is an undirected graph with vertices and edges. Then Yuta does operations on this graph. Each operation is described by two integers and can be split into three steps:
- Delete all the edges which have at least one vertice outside the range .
- Yuta wants you to tell him the number of connected component of the graph.
- Restore the graph. This task is too hard for Rikka to solve. Can you help her?
Input
There are at most 100 testcases and there are at least 97 testcases with . For each testcase, the first line contains three numbers . Then lines follow. Each line contains two numbers which describe an edge of the graph. Then lines follows. Each line contains two numbers which describe an operation.
Output
For each operation you need print a single line with a single number - the answer of this operation.
Sample Input
3 3 2
1 2
1 3
2 3
1 2
1 3
Sample Output
2
1
Author
XJZX
Source
2015 Multi-University Training Contest 4