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.
The first line contains a single integer n (3≤n≤106), the number of figures Jaś drew.
The second line contains n integers f1,f2,…,fn (0≤fi≤2) describing the figures in order. fi denotes the i-th figure: 0 is a circle, 1 is a square, and 2 is a triangle.
Print a single word TAK if Małgosia can find three different figures next to each other, or NIE otherwise.