#UnknownID27. XHXMMMl31UhKWg#>?.]
XHXMMMl31UhKWg#>?.]
Statement
I couldn't think of a good title for this problem, so I decided to learn from LeetCode.
— Sun Tzu, The Art of War
You are given three integers , , and ( , ).
You need to find distinct points ( ), ( ), , ( ), having integer coordinates, on the 2D coordinate plane such that:
- their center is ( )
- for all from to
It can be proven that at least one set of distinct points always exists that satisfies these conditions.
The center of points ( ), ( ), , ( ) is $ \left( \frac{x_1 + x_2 + \ldots + x_k}{k}, \frac{y_1 + y_2 + \ldots + y_k}{k} \right) $ .
Format
Input
The first line contains ( ) — the number of test cases.
Each test case contains three integers , , and ( , ) — the coordinates of the center and the number of distinct points you must output.
It is guaranteed that the sum of over all test cases does not exceed .
Output
For each test case, output lines, the -th line containing two space separated integers, and , ( ) — denoting the position of the -th point.
If there are multiple answers, print any of them. It can be shown that a solution always exists under the given constraints.
Sample
4
10 10 1
0 0 3
-5 -8 8
4 -5 3
10 10
-1 -1
5 -1
-4 2
-6 -7
-5 -7
-4 -7
-4 -8
-4 -9
-5 -9
-6 -9
-6 -8
1000 -1000
-996 995
8 -10
相关
在下列比赛中: