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
#include <iostream>

using namespace std;

bool check(long long n)
{
    if(n < 2)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);cin.tie(NULL);cout.tie(NULL);
    long long n;cin>>n;
    long long mod = 10;
    while(mod < n)
    {
        long long A = n / mod;
        long long B = n % mod;
        if(check(A)&& check(B) && B > (mod/10)){cout<<"TAK";return 0;}
        mod *= 10;
    }
    cout<<"NIE";

}