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
时间限制 1 秒
内存限制 128 MB
统计
上一题 下一题