시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 512 MB 26 8 6 42.857%

문제

Two of your friends Alpha and Beta are at A and B, two integer coordinates in 2D plane. You want to take their picture from another integer coordinate C fulfilling following conditions:

  1. C has to be different from A and B.
  2. There is no integer coordinate point on the line segment AC other than its end points.
  3. There is no integer coordinate point on the line segment BC other than its end points.
  4. Triangle ABC must have positive area, that is, C must not lie on the line going through A and B.
  5. There is no integer coordinate point strictly inside triangle ABC.

Don’t forget this is the era of digital photography where people don’t take only one snap. So you also need to find out K such C for each A and B from where you will take pictures.

A point P having coordinate (x,y) is called integer coordinate if both x and y are integers.

입력

First line of the input contains number of test cases T (1 ≤ T ≤ 1000).

In following T lines, there are 5 integers: Ax, Ay, Bx, By, K. Coordinates of A and B are (Ax, Ay) and (Bx, By) respectively. A and B are distinct points. (-109 ≤ Ax, Ay, Bx, By ≤ 109, 0 ≤ sum of all K ≤ 20 000)

출력

For each case print K lines each containing coordinate of C in: “Cx Cy” format. You may assume that there are at least K such C points. You may output the C points in any order, but these K points has to be distinct. Also all the Cx and Cy have to be between -1014 and 1014. For details of output format please consult the sample input output. 

예제 입력 1

2
1 1 10 1 2
0 0 -10 -10 2

예제 출력 1

2 2
3 2
-1 0
-2 -1