1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#include <iostream>

#define LLU unsigned long long int
using namespace std;

LLU q = 37, h1, h2, pot = 1;
//**********************************************************************************************
int main()
{
    int n;
    scanf("%d", &n);
    char c;
    while(cin >> c) {
        h1 *= q; h1 += c - 'a';
        h2 += pot * (c - 'a'); pot *= q;
    }
    if(h1 == h2) printf("TAK\n");
    else printf("NIE\n");
}