1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include<iostream>
using namespace std;

unsigned long long hash_base=70032301;
unsigned long long multiply=1;

int main(){
	
	int n;
	cin>>n;
	
	char letter;
	
	unsigned long long number=0;
	unsigned long long reversed_number=0;
	
	while(cin>>letter){
		number=number*hash_base + (int)letter;
		reversed_number+= (int)letter*multiply; 
		multiply*=hash_base;
	}
	
	if(number==reversed_number){
		cout << "TAK";
	}else{
		cout << "NIE";
	}
}