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
#include <bits/stdc++.h>
using namespace std;

long long n,x,a,b;
int nums;
bool ans = 0;

bool isPrime(long long n)
{
    bool ans = 1;
    for(long long i=2;i*i<=n;i++)
    {
        if(n%i==0) ans = 0;
    }
    return ans;
}

int numbers(long long n)
{
    int ans;
    while(n>0)
    {
        ans++;
        n/=10;
    }
    return ans;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin >> n;
    x = n;
    while(x>0)
    {
        nums++;
        x/=10;
    }
    for(int i=1;i<nums;i++)
    {
        a = n/pow(10,nums-i);
        b = fmod(n,pow(10,nums-i));
        if(isPrime(a) && isPrime(b) && numbers(a) + numbers(b) == nums) ans = 1;
    }
    if(ans) cout << "TAK";
    else cout << "NIE";
}