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
43
44
45
46
47
48
49
50
#include<cstdio>
#include<iostream>
#include<sstream>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>
#include<list>
#include<vector>
#include<stack>
#include<queue>
#include<string>
#include<iomanip>
#include<fstream>
#include<ctime>
using namespace std;
typedef vector<int> VI;
typedef pair <int,int> ii;
typedef long long LL;
#define pb push_back

bool prime(LL x) {
	if (x == 1) return false;
	for (LL i=2;i*i<=x;i++) if (x % i == 0) return false;
	return true;	
}

LL n, k, d1, d2;
bool res;

int main() {
cin >> n;
k = 10;
res = false;
while (true) {
	d1 = n % k;
	d2 = n / k;
	//cout << d1 << " " << d2 << endl;
	if (d1 == n) {
		break;
	}
	if (d1 >= k / 10 && prime(d1) && prime(d2)) {
		res = true;
		break;
	}
	k *= 10;
}
if (res) printf("TAK\n"); else printf("NIE\n");	
return 0;
}