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
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <cstdio>
#include <sys/types.h>
       #include <unistd.h>



using namespace std;

int ende() {
	int i = 1; char c;

	do {
		rewind(stdin);
		fseek(stdin, -i++, SEEK_END);
		c = getchar();
	} while(! ( 'a' <= c && c <= 'z'));
	return ftell(stdin) - 1;
}

int main() {
		rewind(stdin);

	int r;
	scanf("%d\n", &r);
	const int begin = ftell(stdin);
	const int end = ende();

	for (int i = 0; i <= (end - begin) / 2; i++) {
		char a, b;
		fseek(stdin, begin + i, SEEK_SET);
		a = getchar();
		fseek(stdin, end - i, SEEK_SET);
		b = getchar();
		if (a != b) {
			printf("NIE\n");
			return 0;
		}
	}
	printf("TAK\n");
	return 0;
}