In the event of technical difficulties with Szkopuł, please contact us via email at szkopul@fri.edu.pl.

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.

A testing track in the factory of hovercrafts is built of standard blocks of different heights. In a perfectly built track, called lollobrigida, there are neither two neighbouring blocks of equal height nor three consecutive blocks with either increasing or decreasing heights.

To express it more formally, let denote the sequence of heights of blocks belonging to a track. If for each the following conditions are satisfied:

- and or
- and ,

then we can call such a track **lollobrigida**.

One cannot build a lollobrigida with the set of blocks of heights: , because two blocks of height would have to stand side by side or one of the following sequences would have to appear in it: or , and these are not allowed.

Here is an example of a lollobrigida built with another set of blocks - . One can build also other lollobrigidas with this set

Write a program which reads the number of sets of data from the standard input and for each set:

- reads the number of blocks and the height of each block,
- checks if one can build a lollobrigida with this set,
- writes the answer to the standard output.

In the first line of the standard input there is one integer , , equal to the number of sets of data. In the next line of the standard input the first set of data begins.

In the first line of each set of data there is one integer , , which is equal to the number of blocks in this set.

In the following lines there are heights of blocks. Each line contains one integer equal to the height of the corresponding block, .

Next sets of data follow one after another.

The text of the standard output should contain exactly lines, one for each set of data. One word should be written in the -th line of the standard output:

- TAK (which means YES in Polish), if one can build a lollobrigida, with the -th set
- NIE (which means NO in Polish), in the other case.

For the input data:

2 5 3 3 3 5 2 6 3 3 1 5 2 2

the correct result is:

NIE TAK

*Task author: Piotr Chrzastowski-Wachtel*