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

using namespace std;

int prime(long long num){
    if (num <= 1) return 0;

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

int main() {
    string str;
    cin >> str;

    for (int i=1; i<str.length(); i++){
        string first = str.substr(0,i);
        string second = str.substr(i);
        long long f = stoll(first);
        long long s = stoll(second);
        string ss = to_string(f) + to_string(s);
        if (prime(f) && prime(s) && ss.compare(str) == 0){
            cout << "TAK"<<endl;
            return 0;
        }
    }

    cout << "NIE" << endl;
    return 0;
}