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
#include <stdio.h>
#include <ctype.h>

#define INI 5381
#define K 33

int main()
{
	int n;
	char c;
	long long int p = 0, q = 0;
	long long int k = 1;

	scanf("%d\n", &n);
	while ((c = getchar()) != EOF && isalnum(c)) {
		p *= K;
		p += c;
		q += k * c;
		k *= K;
	}

	printf(q == p ? "TAK\n" : "NIE\n");

	return 0;
}