#P2004. xay loves trees

xay loves trees

题目描述

Click here to read PDF of this problem

输入格式

As shown in the PDF.

输出格式

As shown in the PDF

样例

3 
5 
2 1 
2 5 
5 3 
2 4 
2 1 
1 5 
1 3 
3 4 
5 
5 3 
3 1 
5 4 
3 2 
5 3 
5 1 
3 4 
3 2 
5 
5 3 
5 1 
5 2 
5 4 
5 3 
3 1 
5 2 
3 4
3 
1 
2

提示

录题人:chimp