Museum

No attempts yetTime limit2sMemory limit128 MB

Problem

Captain Pitt, touring a famous museum, kept running into guards watching over the precious exhibits at every step. Do we really need so many of them? Wouldn’t a single guard be enough? If only we could find the right spot… he thought.

The museum’s floor plan is a polygon whose vertices lie on integer coordinates. Every edge has length 11, and the angle between any two adjacent walls is a multiple of 9090^\circ.

Given the floor plan, decide whether there is a spot inside the museum (its coordinates may be real numbers) from which every part of the museum is visible.

Input

The first line contains the number of test cases ZZ (1Z101 \le Z \le 10). The test cases follow, one after another.

Each test case begins with a natural number NN (4N10000004 \le N \le 1\,000\,000), the number of vertices of the floor plan.

The next NN lines describe the vertices of the polygon in order. Each line contains two natural numbers XiX_i and YiY_i (0Xi,Yi<10000000 \le X_i, Y_i < 1\,000\,000), where XiX_i is the first coordinate and YiY_i the second.

Every two consecutive points (and also the first and the last) are adjacent vertices of the polygon that represents the floor plan.

Output

For each test case, print on its own line TAK if the desired spot exists, and NIE otherwise.

Notes

  • The vertices are listed in the order in which they are met while walking along the boundary, either clockwise or counter-clockwise.
  • The polygon represents an ordinary museum whose walls do not cross one another.
  • Two adjacent walls may form an angle of 180180^\circ (so three consecutive vertices can be collinear).