SP16549 QTREE6 - Query on a tree VI

Description

You are given a tree (an acyclic undirected connected graph) with $n$ nodes. The tree nodes are numbered from $1$ to $n$. Each node has a color, white or black. All the nodes are black initially. We will ask you to perform some instructions of the following form: - `0 u`: ask for how many nodes are connected to $u$, two nodes are connected if all the node on the path from $u$ to $v$ (inclusive $u$ and $v$) have the same color. - `1 u`: toggle the color of $u$ (that is, from black to white, or from white to black).

Input Format

The first line contains a number $n$ that denotes the number of nodes in the tree ($n-1$ lines), there will be two numbers $(u, v)$ that describes an edge of the tree ($1\leq u, v\leq n$). The next line contains a number $m$ denoting number of operations we are going to process ($m$ lines) describe an operation $(t, u)$ as we mentioned above ($0\leq t\leq 1, 1 \leq u\leq n$).

Output Format

For each query operation, output the corresponding result.

Explanation/Hint

$1\leq n,m\leq 10^5$。