Stability

Time Limit: 2000ms
Memory Limit: 102400KB
This problem will be judged on HDU. Original ID: 5458
64-bit integer IO format: %I64d      Java class name: Main

Description

Given an undirected connected graph $G$ with $n$ nodes and $m$ edges, with possibly repeated edges and/or loops. The stability of connectedness between node $u$ and node $v$ is defined by the number of edges in this graph which determines the connectedness between them (once we delete this edge, node $u$ and $v$ would be disconnected).

You need to maintain the graph $G$, support the deletions of edges (though we guarantee the graph would always be connected), and answer the query of stability for two given nodes.

Input

There are multiple test cases(no more than $3$ cases), and the first line contains an integer $t$, meaning the totally number of test cases.

For each test case, the first line contains three integers $n$, $m$ and $q$, where $1 \le n \le 3 \times 10^4, 1 \le m \le 10^5$ and $1 \le q \le 10^5$. The nodes in graph $G$ are labelled from $1$ to $n$.

Each of the following $m$ lines contains two integers $u$ and $v$ describing an undirected edge between node $u$ and node $v$.

Following $q$ lines - each line describes an operation or a query in the formats:
$\cdot$ $1~a~b$: delete one edge between $a$ and $b$. We guarantee the existence of such edge.
$\cdot$ $2~a~b$: query the stability between $a$ and $b$.

Output

For each test case, you should print first the identifier of the test case.

Then for each query, print one line containing the stability between corresponding pair of nodes.

Sample Input

1
10 12 14
1 2
1 3
2 4
2 5
3 6
4 7
4 8
5 8
6 10
7 9
8 9
8 10
2 7 9
2 7 10
2 10 6
2 10 5
1 10 6
2 10 1
2 10 6
2 3 10
1 8 5
2 5 10
2 4 5
1 7 9
2 7 9
2 10 5

Sample Output

Case #1:
0
0
0
0
2
4
3
3
2
3
4

Source

Language: 
Theme: 
Share Code? 

Powered by NB231 | Current Style: .