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

bool isPrime(long long n)
{
	long long k = 2;
	while (k * k <= n)
	{
		if ((n % k) == 0)
			return false;
		else k++;
	}
	return true;
}

int main()//1012345678977
{
	std::string numberAsString;
	std::cin >> numberAsString;

	for (int i = 1;i<numberAsString.size();i++)
	{
		if (numberAsString[i] == '0') continue;

		if (isPrime(atoll(numberAsString.substr(0, i).c_str())) && isPrime(atoll(numberAsString.substr(i, numberAsString.size() - i).c_str())))
		{
			std::cout << "TAK" << std::endl;
			return 0;
		}
	}

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