Under construction

Still being built. Things may change

Permutation

Interview

Time limit1sMemory limit128 MB

Summary
Check whether n given integers contain each number from 1 to n exactly once and print TAK or NIE.
Level

Easy3 of 10

Topics
Array, Hash map
Solved
No attempts yet

Problem

Bajtek wrote nn integers on a piece of paper. Determine whether they form a permutation of the numbers from 11 to nn, that is, whether each of the numbers 1,2,3,…,n−1,n1, 2, 3, \ldots, n-1, n appears exactly once in the sequence.

Input

The first line contains a single integer nn (1≤n≤1061 \le n \le 10^6), the count of numbers Bajtek wrote.

The second line contains nn integers a1,a2,…,ana_1, a_2, \ldots, a_n (0≤ai≤1090 \le a_i \le 10^9) separated by spaces, where aia_i is the ii-th number in the sequence.

Output

Print TAK on the first and only line if Bajtek's sequence is a permutation of the numbers from 11 to nn, or NIE otherwise.

Examples1

  1. Example 1

    Input
    5
    1 4 3 2 5
    
    Expected output
    TAK