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

using namespace std;

bool prime(long long int n){
  if (n<=1) return false;
  unsigned int g = (unsigned int)sqrt(n);
  
  for(int i = 2; i <= g; i++) {
     if (n % i == 0) return false;
  }
  return true;
}

int main()
{
  unsigned long long int n,p,q;
  cin >> n;
  for (unsigned long long int i=10;i<=n;i=i*10){
    p= n/i;
    q= n%i;
    //cout << p << " " << prime(p) << ",  " << q << " " << prime(q)<< endl;
    if (prime(q)==true && prime(p)==true) {
	 if (q*10/i>0) {
		cout <<"TAK";
		return 0;
	 }
	}
  }
  cout << "NIE";
  return 0;
}