Figures

No attempts yetTime limit1sMemory limit128 MB

Problem

Jaś drew some figures in his notebook: circles, squares, and triangles, all in a single straight row. After finishing, he lent the notebook to Małgosia, who sits next to him.

Małgosia wants to find three different figures (a circle, a square, and a triangle), in any order, sitting right next to each other. Determine whether she can find such three different figures placed side by side.

Input

The first line contains a single integer nn (3n1063 \le n \le 10^6), the number of figures Jaś drew.

The second line contains nn integers f1,f2,,fnf_1, f_2, \dots, f_n (0fi20 \le f_i \le 2) describing the figures in order. fif_i denotes the ii-th figure: 0 is a circle, 1 is a square, and 2 is a triangle.

Output

Print a single word TAK if Małgosia can find three different figures next to each other, or NIE otherwise.