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 <math.h>     

using namespace std;

bool isPrime(long long l){
    long long sqrtval = sqrt(l);
    if(l==0)return false;
    if(l==1)return false;
    if(l==2)return true;
        if(l%2==0)
            return false;
    for(long long i = 3 ;i <= sqrtval; i+=2){
        if(l%i==0)
            return false;
    }
    return true;
}

int main()
{
   long long mipa,t1,ta,tb,flag=true;
   cin >> mipa;
   t1 = 10;
   while(mipa/t1 > 0){
       ta = mipa/t1;
       tb = mipa%t1;
       if(((mipa%t1)/(t1/10)!=0) && isPrime(ta) && isPrime(tb)){
           flag=false;
           cout<<"TAK";
           break;
       }
       t1*=10;
   }
   if(flag)
        cout<<"NIE";
   return 0;
}