403962: GYM101375 C MaratonIME eats japanese food
Description
After a long time eating japanese food, the members of MaratonIME are getting really good at it. Nowadays, a massive amount of japanese food is eaten by the group and it's often difficult to find space for all the plates in the table, since two plates can touch but never overlap. The fact that there is so much food in each plate makes this even worse, because they can't move the plates on the table until there is no more food in them.
For that reason, everytime a plate arrives, they need to try lots of different positions for that plate on the table. You need to help them by creating a program that will aid on that rampant gluttony. Your program starts off with an empty table and has to respond to various queries, each of one of two types:
- A x y r - Place a circular plate centered at (x, y) with radius r.
- R x y r - Remove the circular plate centered at (x, y) with radius r.
For each plate, its center position (x, y) and its radius are given in centimeters (the plate's located x centimeters away from the left border and y centimeters away form the upper border). The table always has 10 meters both in width and height and a plate is allowed to hang off the table, as long as it's center is on the table (or on its border).
For each query of type A, you must determine if it was possible to place the given plate on the given position (if that plate does not overlap any other, note that it is allowed for it to touch other plates) and place it if possible. For each query of type R, you must determine if it was possible to remove that plate on the given position from the table (if there is a plate with those coordinates and radius on that position) and remove it if possible.
InputOn the first line of the input an integer Q ≤ 5000 is given, the amount of queries that need to be answered.
On each one of the Q following lines the queries are described. Each of them is given by a character , the type of the query, and three integers x, y and r, the coordinates and radius of the plate, 0 ≤ x, y ≤ 1000 and 1 ≤ r ≤ 1000.
OutputFor each query, print a line with "Ok" (without quotes) if it is possible to perform such query (add the plate on type A and remove the plate on type R) and "No" otherwise.
ExampleInput8Output
A 20 25 15
A 25 25 5
A 20 55 15
A 35 40 7
A 35 40 6
R 20 25 15
A 20 25 10
R 20 25 15
Ok
No
Ok
No
Ok
Ok
Ok
No