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

题目描述

NIO has a tree T rooted at 1.

He defines the hash function of T as , where  and  is the lowest common ancestor of i and j.

Unfortunately, he lost the tree in an accident. The only thing he remembers is F(T).

Now given F(T) and X,Y,Z, you need to reconstruct T with no more than 50 vertices.

输入描述:

The first line contains an integer  indicating the number of test cases.

For each test case, the only line contains four integers .

It is guarenteed that X,Y,Z are chosen randomly from range .

输出描述:

For each test case, output n lines, where n is the number of vertices of the tree.

The first line output n. You should make sure that .

The next n-1 lines output two integers  indicating an edge in your tree. These n - 1 edges should form a tree.
示例1

输入

复制
1
36 2 3 2

输出

复制
2
1 2