|Codeforces Round #407 (Div. 1)|
After some programming contest Roma decided to try himself in tourism. His home country Uzhlyandia is a Cartesian plane. He wants to walk along each of the Main Straight Lines in Uzhlyandia. It is known that each of these lines is a straight line parallel to one of the axes (i.e. it is described with the equation x = a or y = a, where a is integer called the coordinate of this line).
Roma lost his own map, so he should find out the coordinates of all lines at first. Uncle Anton agreed to help him, using the following rules:
Uncle Anton is in a hurry to the UOI (Uzhlandian Olympiad in Informatics), so he can only answer no more than 3·105 questions.
The problem is that Roma doesn't know how to find out the coordinates of the lines. Write a program that plays Roma's role and finds the coordinates.
There is no input initially. Your program should make queries to get information.
It is guaranteed that the number of horizontal and vertical lines is at least 1 and less than or equal to 104 for each type.
To make a query, print a line "0 x y" (-108 ≤ x, y ≤ 108), where x and y are the coordinates of the point. After each query you need to print end-of-line, make "flush" operation, and then read the answer to the query — the minimum among the distances prom this point to the Main Straight Lines of Uzhlyandia.
You can do no more than 3·105 queries.
When you are ready to print the answer, print three lines:
You can print coordinates in arbitrary order.
To make "flush", you can use (just after printing a query/answer and end-of-line):
You will get Wrong Answer if you make more queries than allowed or make an invalid query.
You can get Idleness Limit Exceeded if you don't print anything or if you forget to flush the output.
If at any moment your program reads -1 as an answer, it should immediately exit normally (for example, by calling exit(0)). You will get Wrong Answer in this case, it means that you made more queries than allowed, or made an invalid query. If you ignore this, you can get other verdicts since your program will continue to read from a closed stream.
Making test for hacking
The first line should contain two integers n and m (1 ≤ n, m ≤ 104).
The second line should contain n distinct integers x i (-108 ≤ x i ≤ 108) — the coordinates of the vertical lines.
The third line should contain m distinct integers y i (-108 ≤ y i ≤ 108) — the coordinates of the horizontal lines.
You can write coordinates in arbitrary order.
You can see the example case in the notes.
0 1 2
0 -2 -2
0 5 6
0 -2 2
1 1 2
The example test is
The minimum distances are: