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
48
49
50
#include <bits/stdc++.h>
//#include "one.h"

using namespace std;

bool prime(long n) {
  if (n < 2) return false;

  for (long i = 2; i*i <= n; i++) {
    if (n % i == 0) return false;
  }

  return true;
}

using Candidates = vector<pair<long, long>>;

Candidates candidates(long n) {
  Candidates v;
  string s = to_string(n);
  size_t length = s.length();
  for (int i = 1; i < s.length(); i++) {
    if (s[i] != '0') {
      v.push_back(make_pair(
        stol(s.substr(0, i)),
        stol(s.substr(i, length-i))
      ));
    }
  }

  return v;
}

bool is_double(long n) {
  if (n < 10) return false;

  for (auto i : candidates(n)) {
    if (prime(i.first) && prime(i.second)) {
      return true;
    }
  }

  return false;
}

int main() {
  long n;
  scanf("%ln\n", &n);
  printf(is_double(n) ? "TAK\n" : "NIE\n");
}