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

题目描述

MianKing has two labeled unrooted trees with nodes and he wants to transform to by some operations.

In each operation, MianKing can select four distinct nodes which forms a path in the tree . Then he removes edges from , chooses three new edges whose endpoints and adds these new edges to . MianKing has to guarantee that is still a tree after this operation.

Now you need to help MianKing to transform to within operations. 

输入描述:

The first line has one integer .

Then there are lines, each lines has two integers which denotes an edge in .

Then there are lines, each lines has two integers which denotes an edge in .



It's guaranteed that and are both trees.

输出描述:

The first line has one string "YES" if there exists a solution to transform  to  within  operations, otherwise "NO". (both without quotation)

If there exists a solution, then:

The first line has one integers which denotes the number of operations of your solution.

Then for each operations, there are two lines which represent this operations. The first line has four integers and the second line has six integers a_1,b_1,a_2,b_2,a_3,b_3 which (a_i,b_i) denotes the i-th new edge you choose in this operation.

For each operation, you should guarantee these conditions:

1.

2. are distinct and form a path in the tree at that time.

3.

4. After removing edges and add new edges (a_1,b_1),(a_2,b_2),(a_3,b_3), is still a tree at that time. 

5. After all of the operations, should be the same as .

6.

Two labeled tree are same if and only if for all edge
示例1

输入

复制
5
1 2
2 3
3 4
2 5
1 2
2 3
3 4
1 5

输出

复制
YES
2
5 2 3 4
2 3 3 5 3 4
1 2 3 5
1 5 1 2 2 3
示例2

输入

复制
4
1 2
1 3
1 4
1 2
2 3
3 4

输出

复制
NO
示例3

输入

复制
4
1 2
1 3
1 4
1 2
1 3
1 4

输出

复制
YES
0