Symmetry: Tree
时间限制:C/C++/Rust/Pascal 2秒,其他语言4秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
Special Judge, 64bit IO Format: %lld

题目描述

Given a tree with n vertices, find an integer point for each node i (, 2, , n) and connect the p_u and p_v with a line segment for each edge (u,v), such that:

1. No two points coincide.
2. No two line segments have common points except at both endpoints.
3. There exists a line such that the shape formed by the points is symmetric about the line and the shape formed by the line segments is symmetric about the line.

输入描述:

There are multiple test cases. The first line of input contains an integer T(), the number of test cases. For each test case:

The first line contains an integer n (), the number of vertices of the tree.

Each of the following n-1 lines contains two integers u and v(, , ), denoting an edge connecting u and v.

Note that there are no constraints related to the sum of n.

输出描述:

For each test case:

If there is no answer, output the “NO” in the only line.

Otherwise, output “YES“ in the first line, and two integers x_i, y_i () in the i-th of the following n lines.

In the  -th line, output three integers a, b, c (,,), denoting that the shapes are symmetric about the .

If there are multiple answers, output any of them.
示例1

输入

复制
5
4
3 2
1 3
4 1
4
2 4
1 4
3 4
9
9 7
4 9
8 4
4 6
1 8
2 6
5 1
3 4
10
5 3
4 5
6 4
2 5
5 8
4 9
7 8
1 2
10 6
7
2 7
7 4
7 5
6 2
4 3
2 1

输出

复制
YES
1 0
-2 0
-1 0
2 0
1 0 0
YES
1 0
0 1
-1 0
0 0
1 0 0
YES
0 3
-2 0
0 0
0 1
0 4
-1 0
2 0
0 2
1 0
1 0 0
NO
NO