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

using namespace std;

typedef long long ll;

bool Pier(ll x)
{
    if (x == 1)
        return false;
    if (x == 2)
        return true;
    for (ll i = 2; i * i <= x; ++i)
        if (x % i == 0)
            return false;
    return true;
}

int main()
{
    ios_base::sync_with_stdio(0);
    string n;
    cin >> n;
    bool ok = false;
    for (int i = 0; i < n.size() - 1; ++i)
    {
        ll x = 0, y = 0;
        for (int j = 0; j <= i; ++j)
            x = 10 * x + (n[j] - '0');
        for (int j = i + 1; j < n.size(); ++j)
            y = 10 * y + (n[j] - '0');
        if (n[i + 1] != '0' && Pier(x) && Pier(y))
            ok = true;
    }
    if (ok)
        cout << "TAK";
    else
        cout << "NIE";
    return 0;
}