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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*Jonatan Hrynko*/
#include<bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef set<int> SI;

const int INF = 1000000007;
const int MAXN = 1000001;

#define FOR(i, b, e) for(int i = b; i <= e; ++i)
#define FORD(i, b, e) for(int i = b; i >= e; --i)
#define REP(i, n) FOR(i, 0, n-1)
#define REV(i, n) FORD(i, n-1, 0)
#define VAR(v, n) __typeof(n) v = (n)
#define ALL(c) (c).begin(), (c).end()
#define FOREACH(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define SIZE(c) (int)(c).size()
#define PB push_back
#define PP pop_back
#define MP make_pair
#define ST first
#define ND second

LL n;
LL a, b;
LL t;

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

int main()
{
	ios_base::sync_with_stdio(0);
	cin>>n;
	t = 10;
	bool res = false;
	bool flag;
	
	while(t <= n)
	{
		flag = ((n/(t/10)) % 10 != 0);
		
		a = n/t;
		b = n%t;
		
		if(flag)
		{
			//~ cout<<a<<" "<<b<<"\n";
			if(isPrime(a) && isPrime(b)) 
			{
				res = true;
				
			}
		}
		t*=10;
	}
	
	cout<<(res ? "TAK" : "NIE");
	
	return 0;
}

/*
15485867533000389

10399999999999971
100000000710000007
*/