The Byteotian Space Agency is working on a new project. They want to build a space base on Bajmars. The first stage of the project has already been completed. Areas for the construction of space facilities have been prepared on Bajmars. Because the surface of Bajmars is heavily damaged by erosion and it would be dangerous to build anything directly on it, rectangular, flat platforms have been built on metal bases above the surface of Bajmars. All platforms are at the same height above the planet's surface and, naturally, do not overlap.
Now, the second stage of the base construction is beginning. Various space facilities are to be built on the prepared terrain. Each facility is shaped like a rectangular cuboid. So far, many plans for the placement of objects on the surface have been created. Your task is to write a program that, for each object, determines whether it is possible to place it where the project indicates.
Objects should be placed on the prepared platforms, although their bases do not have to rest entirely on the platforms. It is sufficient for the object to stand stably on one or more platforms. This is the case if the center of gravity of the object is located above the surface of a platform (including its edge) or if at least three of its corners are resting on platforms.
You can assume that the center of gravity of the object is located above the intersection point of the diagonals of its base. A corner is resting on a platform if it is located inside it or on its edge. Do not worry if too large a part of the object is in the Bajmars air. Remember that these are only plans for objects, so the fact that two objects are planned to be built in the same place or that the planned positions collide with each other is of no significance.
Task
Write a program that:
- reads the coordinates of the platform vertices and the proposed positions of subsequent objects,
- for each object, checks whether it will stand stably,
- prints the appropriate answer for each object.
Input
The first line contains the number of platforms $n$, $1 \le n \le 25\,000$. The next $n$ lines describe the positions of the individual platforms. The $i$-th of these lines contains four integers $x_{1,i}$, $y_{1,i}$, $x_{2,i}$, $y_{2,i}$ - the coordinates of the bottom-left and top-right corners of the $i$-th platform, $-10^9 \le x_{1,i} < x_{2,i} \le 10^9$ and $-10^9 \le y_{1,i} < y_{2,i} \le 10^9$. The next line contains the number $q$ - the number of object plans, $1 \le q \le 25\,000$. Each of the following $q$ lines contains a description of one plan. The $j$-th line contains four integers $x'_{1,j}$, $y'_{1,j}$, $x'_{2,j}$, $y'_{2,j}$ - the coordinates of the bottom-left and top-right corners of the base of the $j$-th planned object, $-10^9 \le x'_{1,j} < x'_{2,j} \le 10^9$ and $-10^9 \le y'_{1,j} < y'_{2,j} \le 10^9$.
Output
Your program should print exactly $q$ lines. The $j$-th line should contain one word TAK if the $j$-th object can be placed stably, or NIE otherwise.
Examples
Input 1
4 5 0 7 3 0 4 3 6 5 7 7 10 1 2 2 3 4 0 5 1 6 2 3 5 5 6 4 8 6 4 7 8 9
Output 1
TAK TAK NIE TAK