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 <bits/stdc++.h>
using namespace std;
bool p(long long int a) {
	if (a < 4) return true;
	for (long long int x = 2; x * x <= a; x++) {
		if (x * (a/x) == a) return false;
	}
	return true;
}
int main() {
	string s;
	cin >> s;
	for (int i = 1; i < s.length(); i++) {
		if (s[i] == '0' || s[0] == '0') continue;
		long long int a = atoll(s.substr(0, i).data()), b = atoll(s.substr(i, -1).data());
		if (a < 2 || b < 2) continue;
		// printf("%lld %lld %d %d\n", a, b, p(a), p(b));
		if (p(a) && p(b)) {
			printf("TAK\n");
			return 0;
		}
	}
	printf("NIE\n");

}