Mirror Tender

No attempts yetTime limit1sMemory limit256 MB

Problem

Bajtazar's company makes wooden wardrobes with mirrored doors. The company does the woodwork itself and subcontracts the mirrors.

A tender run by the company has just closed. nn workshops took part, and each one stated the mirror sizes it can produce. Every mirror is a rectangle. A workshop's bid gives the smallest and the largest width it can produce, and the smallest and the largest height. Mirrors cannot be rotated when a wardrobe is built.

If one workshop's bid covers all the other bids, meaning no other bidder offers a mirror size that this workshop cannot produce, that workshop wins the tender. If several workshops submit a covering bid, the one with the lowest price per square centimetre of mirror wins. If no such workshop took part, the review gets complicated and the award is delayed by a lot. Bajtazar wants to avoid a pointless argument, so he asked you to write a program that decides whether some workshop's bid covers all the other bids.

Input

The first line contains one integer tt (1t101 \le t \le 10), the number of test cases. Descriptions of the tt test cases follow.

The first line of each description contains one integer nn (2n1000002 \le n \le 100\,000), the number of mirror workshops that bid in the tender. Each of the next nn lines contains four integers w1w_1, w2w_2, h1h_1, h2h_2 (1w1w21091 \le w_1 \le w_2 \le 10^9, 1h1h21091 \le h_1 \le h_2 \le 10^9). That workshop can produce a mirror of every integer width ww and every integer height hh with w1ww2w_1 \le w \le w_2 and h1hh2h_1 \le h \le h_2.

Output

Print exactly tt lines, one per test case. Line ii contains TAK if the ii-th test case has a workshop whose bid covers all the other bids, and NIE otherwise.