Synchronization

No attempts yetTime limit8sMemory limit128 MB

Problem

A company runs NN servers around the world. Each server initially stores one unique piece of information: server ii stores information ii, and no two servers start with the same piece.

The company connects servers with communication lines so information can be shared. Whenever two servers become able to reach each other through the currently active lines, they synchronize: after synchronizing, every server in the same connected group holds the union of all pieces that any server in that group held. In other words, servers that are connected (directly or indirectly) always share exactly the same set of pieces.

To keep costs down, only N1N-1 lines are ever installed, and they are chosen so that, if all of them were active at the same time, the servers would form a single tree (there is a unique simple path between any two servers).

At time 00, no line is active. Because some lines run through harsh environments, a line may go down and later be rebuilt. At each time jj (for 1jM1 \le j \le M) the state of exactly one line changes: if that line is currently inactive it becomes active, and if it is currently active it becomes inactive. All synchronization triggered by a change at time jj finishes before time j+1j+1.

Important: information is never lost. When an active line goes down and a group splits into two, each side keeps every piece it already held.

After all MM changes have been applied, report, for several chosen servers, how many distinct pieces of information that server holds.

Input

The input is given through standard input in the following format.

  • The first line contains three integers NN, MM, and QQ: the number of servers, the number of line-state changes, and the number of servers to query.
  • Each of the next N1N-1 lines contains two integers XiX_i and YiY_i (1iN11 \le i \le N-1): line ii, when active, connects server XiX_i and server YiY_i.
  • Each of the next MM lines contains one integer DjD_j (1jM1 \le j \le M): at time jj the state of line DjD_j is toggled.
  • Each of the next QQ lines contains one integer CkC_k (1kQ1 \le k \le Q): report the number of distinct pieces of information held by server CkC_k after all changes.

Output

Print QQ lines. The kk-th line must contain a single integer: the number of distinct pieces of information held by server CkC_k after all MM changes have been applied.

Constraints

  • 2N1000002 \le N \le 100\,000.
  • 1M2000001 \le M \le 200\,000.
  • 1QN1 \le Q \le N.
  • 1Xi,YiN1 \le X_i, Y_i \le N and XiYiX_i \ne Y_i for 1iN11 \le i \le N-1.
  • 1DjN11 \le D_j \le N-1 for 1jM1 \le j \le M.
  • 1CkN1 \le C_k \le N for 1kQ1 \le k \le Q.
  • All values CkC_k are distinct.
  • If every line is active at once, the servers are connected (the N1N-1 lines form a tree).

Example walkthrough

Consider the first sample, with 55 servers. At the start server ii holds piece ii (for 1i51 \le i \le 5).

  • Time 11: line 11 becomes active and connects servers 11 and 22. Both now hold {1,2}\{1, 2\}.
  • Time 22: line 22 becomes active and connects servers 11 and 33. Together with line 11, servers 11, 22, 33 are connected and all hold {1,2,3}\{1, 2, 3\}.
  • Time 33: line 11 goes down (it was active). Servers 11 and 22 can no longer reach each other, but each keeps {1,2,3}\{1, 2, 3\}.
  • Time 44: line 44 becomes active and connects servers 22 and 55. Both now hold {1,2,3,5}\{1, 2, 3, 5\}. They cannot reach server 11, because line 11 is down.
  • Time 55: line 44 goes down. Servers 22 and 55 each keep {1,2,3,5}\{1, 2, 3, 5\}.
  • Time 66: line 33 becomes active and connects servers 22 and 44. Both now hold {1,2,3,4,5}\{1, 2, 3, 4, 5\}.

In the end servers 11, 44, and 55 hold 33, 55, and 44 distinct pieces respectively, which matches the first sample's output.