Dynamic Graph
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 32 M,其他语言64 M
Special Judge, 64bit IO Format: %lld

题目描述

Bobo has a directed acyclic graph (DAG) with n nodes and m edges whose nodes is conveniently labeled with .
All nodes are white initially.

Bobo performs q operations subsequently.
The i-th operation is to change the node v_i from white to black or vice versa.

After each operation, he would like to know the number of pairs of nodes (u, v) that u, v are both white and there exists a path from u to v passing only white nodes.

输入描述:

The input contains zero or more test cases and is terminated by end-of-file. For each test case:
The first line contains three integers n, m and q.
The i-th of the following m lines contains two integers a_i, b_i.
The i-th of the last q lines contains an integer v_i.

*
*
*
*
*
* The number of tests cases does not exceed 10.

输出描述:

For each operation, output an integer which denotes the number of pairs.
示例1

输入

复制
3 3 2
2 3
1 3
1 2
1
1

输出

复制
1
3