This page is still under construction.

Parts of this page are still being built. What you see may change.

Baking Pans

Time limit1sMemory limit256 MB

Summary
For each of up to 1000 triples of pan areas, decide whether two circular cakes from the first two pans fit inside the third pan with a nonzero gap between them.
Level

Medium6 of 10

Topics
Geometry, Math, Binary search, Implementation
Solved
No attempts yet

Problem

Maggy loves to bake. She has recently bought three round baking pans of known base area. She baked cakes in the first two of them and intends to take them to a party at a friend's house. However, as carrying two baking pans is quite tricky, it is much more preferable to put both cakes into the third baking pan and carry only it. Maggy cannot really tell whether the cakes will fit. Moreover, she needs to leave some slack between the cakes, as otherwise the icings would mix. Help Maggy out: compute whether the two cakes fit into the third baking pan.

Input

The first line of the input contains one integer tt, the number of data sets (1≤t≤1 0001 \leq t \leq 1\,000). One data set consists of three integers p,d,tp, d, t (1≤p,d,t≤8⋅109)(1 \leq p, d, t \leq 8 \cdot 10^9), each separated by a single space, denoting the areas of the first, second and third baking pan, respectively.

Output

For each data set you should print a single line containing exactly one word: "TAK" (Polish for "yes") if the cakes from the first and second baking pans fit into the third baking pan together, with a non-zero slack, or "NIE" (Polish for "no") in the other case.

Examples1

  1. Example 1

    Input
    3
    3 9 25
    4 9 25
    5 9 25
    
    Expected output
    TAK
    NIE
    NIE