The Largest SCC

Time Limit: 1000 ms Memory Limit: 65536 KiB

Problem Description

Consider a directed graph with N (1 <= N <= 1000) vertices and M (0 <= M <= 20000) edges. The edges are numbered from 1 to M and the vertices are numbered from 1 to N. Now I will make ONE edge bidirectional, and you are to tell me the number of vertices of the largest strong connected components in the new graph.The largest strong connected components is the strong connected components which has the most vertices. After the operation, I will change the edge back. There will be up to Q (1 <= Q <= 20000) such queries.


 At the firest of the input comes an integer t, indicates the testcases to follow. The first line of each case contains three numbers N, M and Q. Then there will be M lines, each of them contains two numbers a,b (a! = b; 1 <= a; b <= N) means there is a directed edge between a and b. The last of each case contains Q lines, each of them contains one integer q, means the edge numbered q will be change to bidirectional. There will not be duplicated edges.


 For every query, output one line contains only one integer number, which is the number of vertices of the biggest strong connected components.

Sample Input

5 4 2
1 2
2 3
1 3
4 1

Sample Output