405839: GYM102133 J Find a triangle
Description
Someone has drawn a non-degenerate triangle with integer coordinates of vertexes on a chequered piece of paper. However, he did not tell anyone, where this triangle is located. Therefore, you are very curious about it. Fortunately, this guy agreed to answer your questions about it. You have to tell him coordinates of two different points (x1, y1) and (x2, y2) and he will draw a directed line and will tell you whether it crosses a triangle or not. If a line crosses the triangle this guy will tell you if the triangle is located on the left or on the right relative to the line.
The answer to each of the questions can be described as follows.
- '+' the triangle is fully located on the right relative to the line.
- '-' the triangle is fully located on the left relative to the line.
- 'X' line crosses the triangle at least in one point
After each request you will be given a line, which can be one of three possible characters ('-', '+' or 'X').
OutputTo make a request you have to print a line according to a following format. All coordinates must be integer. Q x1 y1 x2 y2.
If you figured out the final location of the triangle, you have to print the line in a following format A x1 y1 x2 y2 x3 y3. If you guessed the correct location of the triangle, the order of points does not affect the correctness of your answer.
Please note, that you have to print a new line character after each request and flush the buffer. For example, you can do it using fflush(stdout) in C++, System.out.flush() in Java, and flush(output) in Pascal.