#ds502. 图染色
图染色
Graph Coloring
Problem Description
You are given a graph with nodes and edges. Each node is initially white.
You must support operations:
1 x: flip the color of node (black to white, or white to black).2 x: query how many black neighbors node has.
Input Format
The first line contains three integers , , and (, , ).
The following lines each contain two integers and (, ), representing an edge. There are no duplicate edges.
The following lines each contain two integers describing an operation.
Output Format
For each query operation, output one line containing a number: the answer.
Sample Input
3 3 5
1 2
2 3
1 3
2 1
1 2
1 3
2 1
2 2
Sample Output
0
2
1
Constraints
, , .