#jag2018summerday2g. [jag2018summer_day2_g]Construct One Point
[jag2018summer_day2_g]Construct One Point
Problem Statement
You have triangles, numbered through .
The coordinates of the vertices of the -th triangle are , and in counterclockwise order. Here, , , , , and are all integers.
For each triangle, determine if there exists a grid point contained in its interior (excluding the boundary). If it exists, construct one such point.
Constraints
- All input values are integers.
- $0 \\leq x_{i1}, x_{i2}, x_{i3}, y_{i1}, y_{i2}, y_{i3} \\leq 10^9$
- , and are in counterclockwise order.
- The areas of the triangles are not .
Input
Input is given from Standard Input in the following format:
Output
Output should contain lines.
In the -th line, if there is no grid point contained in the interior (excluding the boundary) of the -th triangle, print -1 -1
. If it exists, choose one such grid point, then print its -coordinate and -coordinate with a space in between.
Sample Input 1
4
1 7 3 5 5 7
1 4 1 2 5 4
6 1 7 1 7 6
11 3 11 4 8 5
Sample Output 1
3 6
2 3
-1 -1
10 4