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;

bool isPrime(long long number) {
	if(number == 2 || number == 3) {
		return true;
	}
	else if(number < 5 || number%2 == 0 || number%3 == 0) {
		return false;
	}
	else {
		for(long long i = 5; i*i <= number; i+=6) {
			if(number%i == 0 || number%(i+2) == 0) {
				return false;
			}
		}
	}
	return true;
}

int main(int argc, char* argv[]) {
	string input;
	cin >> input;
	int inputLength = input.length();

	for(int i = 1; i < inputLength; i++) {
		string left = input.substr(0, i);
		string right = input.substr(i, inputLength);
		if(left[0] == '0' || right[0] == '0') {
			continue;
		}
		else if(isPrime(stoll(left)) && isPrime(stoll(right))) {
			cout << "TAK";
			return 0;
		}
	}

	cout << "NIE";
	return 0;
}