Heroes 2
Not long ago the game "Heroes of Keyboard and Mouse 2" was released. The 4D-Action essence be the following: A number of cities are placed in a four-dimensional space. Every city is located in a certain point. The player can build new cities. And rob "corovans".
At all times all cities are surrounded by a single connected wall of a finite size. The wall splits the game space into two parts: everything that’s within it and all that’s outside. The wall is built so that:
All the cities are within the wall.
There is a straight path between any two points within the wall, not crossing the wall.
The set of points within the wall is minimal as long as the conditions 1 and 2 are met.
When a new city is built, the wall has to be rebuilt if the city lies outside it. Your task is to define whether wall reconfiguration is necessary for every newly built town.
It is guaranteed that a new city is always built either outside of the existing wall or within it. Moreover, the distance from the new city to the wall is always greater than 10^{–3}. No two cities occupy the same point.
Input
The game begins with five cities with the coordinates (x_1, y_1, z_1, w_1), (x_2, y_2, z_2, w_2), …, (x_5, y_5, z_5, w_5), which are defined in the first five lines of the input file. The initial 4D volume within the wall is strictly positive.
The second line contains an integer N — the number of newly built cities (1 ≤ N ≤ 800). Each of the following N lines contains four integers — the coordinates of a newly built city. The absolute value of each coordinate does not exceed 5000.
Output
The output file must contain N lines. The K-th line must contain the word Rebuild, if wall reconfiguration is necessary after building K-th town, and the word Ignore otherwise (1 ≤ K ≤ N).
Comments
Initially five cities are placed at the vertices of a coordinate simplex with the length 8 along the axes. The wall is exactly the boundary of the simplex. The equation of the large hyperplane of the simplex is the following: x + y + z + w = 8.
As it can be seen from the equation, the first newly built city belongs to the simplex and doesn’t require wall reconfiguration, and the second city lies outside the simplex and the wall must be rebuilt. Once the wall has been rebuilt, the set of interior points consists of two adjacent simplexes.
When the third city is built, the wall is reconfigured, and after that the set of interior points also consists of two simplexes. The fourth city belongs to this set, and the fifth apparently lies outside of it.