Bytean Road Race

No attempts yetTime limit3sMemory limit64 MB

Problem

The Bytean Road Race will be held tomorrow in the center of Bytetown. The city's streets form a regular grid: every street runs either south-to-north or west-to-east. Runners may use only certain marked parts of these streets.

Byteasar has to place the sponsors' banners at some of the crossings, so he studies the race map. The map shows the street segments the runners are allowed to use. There are nn crossings and mm horizontal or vertical road segments. Each segment begins and ends at a crossing and contains no crossing in its interior; two segments may meet only at a crossing.

The crossings are numbered from 11 to nn. The race starts at crossing 11 and finishes at crossing nn. Each runner chooses their own route, but may move only south and east, and only along the marked segments. The marked segments are arranged so that, obeying these rules, the finish can be reached from every crossing and every crossing can be reached from the start.

Byteasar wants no runner to see the same sponsor's banner twice. To arrange this he needs to know, for certain pairs of crossings, whether some runner's route can pass through both crossings of the pair. Help him answer these questions.

Input

The first line contains three integers nn, mm, and kk (2n1000002 \le n \le 100\,000, 1m2000001 \le m \le 200\,000, 1k3000001 \le k \le 300\,000): the number of crossings, the number of marked segments, and the number of crossing pairs to check.

The next nn lines describe the crossings. The ii-th of them contains two integers xix_i and yiy_i (109xi,yi109-10^9 \le x_i, y_i \le 10^9), the coordinates of crossing ii. The OXOX axis points east and the OYOY axis points north. Moreover x1xnx_1 \le x_n and y1yny_1 \ge y_n, and no two crossings lie at the same point.

Each of the next mm lines contains two integers aia_i and bib_i (1ai,bin1 \le a_i, b_i \le n, aibia_i \ne b_i): the two crossings joined by one segment. Every segment is horizontal or vertical, and two segments meet only at a shared endpoint.

Each of the next kk lines contains two integers pip_i and qiq_i (1pi,qin1 \le p_i, q_i \le n, piqip_i \ne q_i): a pair of crossings to check.

Output

Output kk lines. The ii-th line should contain TAK if some runner's route can pass through both crossings pip_i and qiq_i (in either order), and NIE otherwise. (TAK means yes and NIE means no.)

Hint