Task
John Marston, the classic character from the game Red Dead Redemption, has reunited with Abigail and the two are renovating their farm at Beecher's Hope.
He has plantations numbered from to , with roads between them, in the form of a tree rooted at . On each plantation he has a number of plants, initially everywhere. Abigail wants to make changes to this tree, and she has kinds of changes:
1 x
: Node gets a new child, initialized to (first is added, then , , etc.)2 x y
: For each node in the subtree rooted at node , the number of plants in node is XORed with .
Now the two of them, like your usual farmers, are curious for each plantation , how many other plantations have the same number of plants as it?
Input
On the first line, the number is given, followed by lines describing the edges of the tree. Then, is given, and the operations with the format described in the statement.
Output
The required answers will be displayed, on a single line, for each node, separated by spaces.
Restrictions and specifications
- ;
- ;
- ;
- ;
- ;
- It is guaranteed that initial edges form a tree.
Subtasks
- For tests worth points: , each edge is of the form , there are only operations of type
- For other tests worth another points: each edge is of the form , there are only operations of type
- For other tests worth another points: , there are only operations of type
- For other tests worth another points: there are only operations of type
- For other tests worth another points: no other restrictions
Example 1
stdin
5
1 2
1 3
1 4
5 3
4
1 3
2 3 2
2 6 3
1 5
stdout
3 3 1 3 1 0 3
Explanation
After the first operation, the edge is added.
After the second operation, the plantations , , have the number of plants XORed by , now having plants.
After the third operation, the plantation has the number of plants XORed by , now having plant.
After the fourth operation, the edge is added.
The number of plants in each plantation are, in order:
0 0 2 0 2 1 0
which corresponds to the solution in the output (the plantation has other plantations with the same number of plants, the plantation only one with the same number of plants, etc.).