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
#include <bits/stdc++.h>
using namespace std;

template <typename T> T load() { T r; cin >> r; return r; }

bool isPrimeNaive(long long n) {
	for (auto i=2ll; i*i<=n; ++i)
		if (n % i == 0)
			return false;
	return true;
}

bool isSecond(long long n) {
	for (auto base = 10ll; base < n; base *= 10) {
		auto firstRightDigit = (n % base) * 10 / base;
		if (firstRightDigit == 0)
			continue;
		auto left = n / base;
		auto right = n % base;
		if (isPrimeNaive(left) and isPrimeNaive(right))
			return true;
	}
	return false;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	auto n = load<long long>();
	auto result = isSecond(n);
	cout << (result ? "TAK" : "NIE") << '\n';
}