CF2026A.Perpendicular Segments

传统题 时间 2000 ms 内存 256 MiB 4 尝试 1 已通过 1 标签

Perpendicular Segments

You are given a coordinate plane and three integers XX, YY, and KK. Find two line segments ABAB and CDCD such that

  1. the coordinates of points AA, BB, CC, and DD are integers;
  2. 0Ax,Bx,Cx,DxX0 \le A_x, B_x, C_x, D_x \le X and 0Ay,By,Cy,DyY0 \le A_y, B_y, C_y, D_y \le Y;
  3. the length of segment ABAB is at least KK;
  4. the length of segment CDCD is at least KK;
  5. segments ABAB and CDCD are perpendicular: if you draw lines that contain ABAB and CDCD, they will cross at a right angle.

Note that it's not necessary for segments to intersect. Segments are perpendicular as long as the lines they induce are perpendicular.

Input

The first line contains a single integer tt (1t50001 \le t \le 5000) — the number of test cases. Next, tt cases follow.

The first and only line of each test case contains three integers XX, YY, and KK (1X,Y10001 \le X, Y \le 1000; 1K14141 \le K \le 1414).

Additional constraint on the input: the values of XX, YY, and KK are chosen in such a way that the answer exists.

Output

For each test case, print two lines. The first line should contain 44 integers AxA_x, AyA_y, BxB_x, and ByB_y — the coordinates of the first segment.

The second line should also contain 44 integers CxC_x, CyC_y, DxD_x, and DyD_y — the coordinates of the second segment.

If there are multiple answers, print any of them.

Note

The answer for the first test case is shown below:

The answer for the second test case: The answer for the third test case: The answer for the fourth test case:

Samples

4
1 1 1
3 4 1
4 3 3
3 4 4
0 0 1 0
0 0 0 1
2 4 2 2
0 1 1 1
0 0 1 3
1 2 4 1
0 1 3 4
0 3 3 0

在线编程 IDE

建议全屏模式获得最佳体验