405299: GYM101875 H Briefcase

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

H. Briefcasetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Tata and Tynati are still too young to understand exactly what their father works with, but they love playing with his briefcase. The briefcase has a combination lock composed of N wheels, and each wheel has all the digits (0 up to 9) engraved in it. The wheels can be rotated to display any combination of the N digits. Tata and Tynati tried to open the briefcase but they soon realized that it would take too much time to find out the right combination. So, instead of trying to open the briefcase, they decided to play a game with the combination lock.

The rules of the game are the following:

  • The game starts with a random initial configuration of the combination lock.
  • The players make their moves alternately. A move consists in choosing one non-zero wheel to spin and decrement the digit on it by one, and in addition, spin zero, one or two other wheels in any position to the right of it to any digit.
  • The game ends when all the wheels display 0. The player who cannot make a move loses.

Tata plays first because she invented the game. Tata and Tynati already played this game hundreds of times, so both play optimally. Given the initial configuration of the game, can you tell who is going to win?

Input

The first line of the input contains a single integer N (1 ≤ N ≤ 100) indicating the number of wheels in the combination lock. The following line contains N integers indicating the digits of the initial configuration of the game from left to right.

Output

Output either TATA or TYNATI indicating the winner of the game knowing that both play optimally.

ExamplesInput
3
223
Output
TATA
Input
4
1110
Output
TATA
Input
4
1111
Output
TYNATI

Source/Category

加入题单

算法标签: