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
#include <bits/stdc++.h>

using namespace std;

bool check(long long a)
{
  for (int i = 2; i * i <= a; i++)
  {
    if (a%i == 0) return 0;
  }
  return 1;
}
int sumacyfr(long long a)
{
  int ctr = 0;
  while (a)
  {
    ctr++;
    a /= 10;
  }
  return ctr;
}
int main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long x = 10;
  int suma = sumacyfr(n);
  while (n/x)
  {
    long long a = n/x;
    long long b = n - a*x;
    if (check(a) && check(b) && sumacyfr(a) + sumacyfr(b) == suma)
    {
      cout << "TAK\n";
      return 0;
    }
    x *= 10;
  }
  cout << "NIE\n";
}