Niebieskie ksi.eczki
VII Olimpiada Informatyczna 1999/2000

Task: LOL
Author: Piotr Chrz±stowski-Wachtel
Lollobrigida

III stage contest  

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 h1,...,hn denote the sequence of heights of blocks belonging to a track. If for each 1 <= i <= n-2 the following conditions are satisfied:

then we can call such a track lollobrigida.

Example

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

Here is an example of a lollobrigida built with another set of blocks - (3, 2, 5, 2, 3, 1). One can build also other lollobrigidas with this set.

Task

Write a program which reads the number of sets of data from the text file LOL.IN and for each set:

Input

In the first line of the text file LOL.IN there is one integer d, 1 <= d <= 100, equal to the number of sets of data. In the next line of the file LOL.IN the first set of data begins.

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

In the following n lines there are heights of blocks. Each line contains one integer h equal to the height of the corresponding block, 1 <= h <= 109.

Next sets of data follow one after another.

Output

The text file LOL.OUT should contain exactly d lines, one for each set of data. One word should be written in the i-th line of the file LOL.OUT:

Example

For the input file LOL.in:

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

The correct answer is the output file LOL.OUT

NIE
TAK