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

bool is_first(long long int n) {
	if(n == 1) 
		return false;
	for(long long i = 2; i*i <= n; i++) {
		if(n % i == 0) 
			return false; 
	}
	return true;
}

int main() {
	ios_base::sync_with_stdio(0);
	long long int n, a, b;
	bool is_second = false;
	
	cin >> n;
	
	for(long long int i = 10; i <= n; i*=10) {
		a = n/i;
		b = n-a*i;
		if(b < i/10) {
			continue;
		} else {
			if(is_first(a) && is_first(b)) {
				is_second = true;
				break;
			}
		}
	}
	cout << (is_second ? "TAK" : "NIE");
	
	
	return 0;
}