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 <cstdio>
using namespace std;

#define LLG(x) LL x; scanf("%lld", &x)

typedef long long LL;

bool prime(LL n) {
	if (n < 2) return 0;
	for (LL d = 2; d * d <= n; ++d)
		if (!(n % d)) return 0;
	return 1;
}

int main() {
	LLG(n);
	for (LL i = 10; i <= n; i *= 10) {
		LL a = n / i, b = n % i;
		if (b / (i / 10) && prime(a) && prime(b)) {
			printf("TAK\n");
			return 0;
		}
	}
	printf("NIE\n");
}