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

using namespace std;

bool IsPrime(long long k) {
  if (k < 3) return k == 2;
  for (int i = 2; i <= ceil(sqrt(k)); ++i) {
    if (k % i == 0) return false;
  }
  return true;
}

int main() {
  long long n;
  scanf("%lld", &n);
  for (long long i = 10; n / i > 0; i *= 10) {
    const long long first = n / i;
    const long long second = n % i;
    if (second >= (i / 10) && IsPrime(first) && IsPrime(second)) {
      printf("TAK\n");
      return 0;
    }
  }
  printf("NIE\n");
  return 0;
}