2836 - 魔法树

Input

Output

Examples

Input

4
0 1
1 2
2 3
4
Add 1 3 1
Query 0
Query 1
Query 2

Output

3
3
2
Time Limit 1 second
Memory Limit 128 MB
Discuss Stats
上一题 下一题