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

题目描述

See Problem N for PDF statements.
As the builder employed by NIO, you need to build more walls for him. Now you have a number of bricks of height 1 but with different lengths. More precisely, you have n bricks of length 1, n-1 bricks of length 2, ..., two bricks of length n-1, and one brick of length n. The width of the bricks is negligible. You need to build a wall with these bricks whose shape must be strictly rectangular. When building the wall, you must keep the height of the bricks at 1, which means you cannot rotate them.

Of course, you can definitely build a wall with a height of 1 and a large length, but it is not a beautiful wall. In NIO's opinion, a beautiful wall should have the minimum possible circumference. Please tell him the minimum circumference of the wall, and how to build it.

输入描述:

The first line contains an integer T (), indicating the number of test cases.

Each test case contains an integer n () in a single line. It is guaranteed that the sum of n over all test cases won't exceed 200.

输出描述:

For each test case, output an integer in a single line, indicating the minimum circumference of the wall. Then in the next  lines, each line contains four integers x_1,y_1,x_2,y_2, indicating that the coordinate of the lower left of the brick is (x_1,y_1), and the upper right is (x_2,y_2).

You can consider the wall as a rectangular in the Cartesian coordinate system, where the x-axis represents the length and the y-axis represents the height. The lower left of the wall must be located at (0,0). If there are multiple solutions, output any.
示例1

输入

复制
4
1
2
3
4

输出

复制
4
0 0 1 1
8
0 1 1 2
1 1 2 2
0 0 2 1
14
2 1 3 2
3 1 4 2
4 1 5 2
3 0 5 1
0 1 2 2
0 0 3 1
18
4 0 5 1
2 3 3 4
3 3 4 4
4 3 5 4
3 1 5 2
3 2 5 3
0 3 2 4
0 1 3 2
0 2 3 3
0 0 4 1

说明

A possible solution for the third test case in the sample: