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
42
#include<cstdio>
#include<vector>
using namespace std;
typedef long long int lld;

bool is_prime(lld a){
	if(a == 0 || a == 1)
		return false;

	for(lld i=2;i*i<=a;i++)
		if(a%i==0)
			return false;

	return true;
}

int main(void){
	lld n,a,b;

	scanf("%lld",&n);

	a=n;

	lld pot=1;
	lld c;

	while(a/10>0ll){
		c=a%10;
		a/=10;

		b=pot*c;
		pot*=10;

		if(c!=0 && is_prime(a) && is_prime(b)){
			printf("TAK\n");
			return 0;
		}
	}

	printf("NIE\n");
	return 0;
}