In the event of technical difficulties with Szkopuł, please contact us via email at [email protected].

If you are familiar with IRC chat, the support team is also reachable on PIRC network (`irc.pirc.pl`

) in `#szkopul`

channel. If you are not, just use email.

Please do not ask us things like "how to solve task XYZ?".

Please remember that the support team has to sleep sometimes or go to work in real life.

The Bytean Road Race is to be held tomorrow in Bytetown city center. The streets of Bytetown form a regular grid: all of them go from the south to the north or from the west to the east. The participants of the race are only allowed to use some given parts of the roads.

Byteasar's task is to place the event's sponsors' banners on some of the crossings, and to do that he has to examine the route map of the race. The map depicts the segments of streets that the runners are allowed to use. There are crossings and vertical and horizontal road segments marked on it. Every segment starts and ends at some crossing and does not contain any other crossings. The road segments may only intersect at the crossings.

The crossings are numbered from to . The race will start at the crossing number and finish at the crossing number . The runners can pick their routes themselves, however they are required to run only south and east and only along the segments marked on the map. The road segments on the map are chosen in such a way that, by running in accordance with the rules, one can get to the finish from any place, and every place is reachable from the start crossing.

Byteasar wants to place the banners in a way that ensures that no runner will see a banner of the same sponsor twice. Therefore, for some pairs of crossings, Byteasar has to check whether it is possible for the route of some participant to go through both crossings. The race takes place tomorrow, so a program that will help him do the task is urgently needed.

The first line of the input contains three integers , and (, , ). They denote the number of crossings on the race route, the number of marked segments on the map and the number of pairs of crossings to be checked, respectively.

The following lines describe the locations of the crossings. The -th of these lines contains the coordinates of the -th crossing represented by two integers , (). In addition, and . There will be at most one crossing at any given point. The axes of the coordinate system correspond to the real world cardinal directions in the natural way: the OX axis goes towards the east, and the OY axis - towards the north.

Each of the following lines contains a description of a single segment on the map, consisting of a pair of integers , () denoting the indices of crossings connected by the segment. All of these segments are either vertical or horizontal and they may only intersect at common endpoints (the crossings).

The next lines contain the descriptions of pairs of crossings to be checked. The -th of these lines contains two integers , (, ).

Your program should output lines.
The -th of these lines should contain the word `TAK` (i.e., *yes* in Polish)
if it is possible for the route of some participant to
go through both crossings and (in any order).
Otherwise the output should be `NIE` (*no* in Polish).

For the input data:

9 10 4 1 6 2 6 4 4 1 4 3 4 4 6 6 4 3 1 6 1 1 2 4 1 2 6 3 6 5 4 5 3 5 8 3 7 7 9 9 8 4 8 2 5 8 7 7 6

the correct result is:

TAK NIE NIE TAK

*Task author: Jakub Lacki.*