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
#include <iostream>
using namespace std;
long long pow[20];
int main()
{
  long long n;
  cin >> n;
  long long x=1;
  int licz=0;
  while(x<n)
  {
    pow[licz]=x;
    x*=10;
    licz++;
  }
  licz--;
  for(int i=1;i<=licz;i++)
  {
    long long a=n%pow[i];
    long long b=n/pow[i];
    //cout << a << " " << b << "\n";
    if(a*10<pow[i] or b*10<pow[licz-i])
    {
      continue;
    }
    long long ilo=1LL;
    for(long long j=1;j*j<=a;j++)
    {
      if(a%j==0LL)
      {
        ilo++;
      }
    }
    long long ilo2=1LL;
    for(long long k=1;k*k<=b;k++)
    {
      if(b%k==0LL)
      {
        ilo2++;
      }
    }
    if(ilo2==2LL and ilo==2LL)
    {
      cout << "TAK";
      return 0;
    }
  }
  cout << "NIE";
}