#include <bits/stdc++.h>
using namespace std;
bool is_prime(int n)
{
for (int i = 2; i < n; ++i) {
if (n % i == 0) {
return false;
}
}
return n > 1;
}
int main()
{
int t;
cin >> t;
while (t--) {
int s;
cin >> s;
bool f = false;
for (int x = 1; x < s; ++x) {
int y = s - x;
if (is_prime(x) && is_prime(y)) {
cout << "TAK " << x << " " << y << endl;
f = true;
break;
}
}
if (!f) {
cout << "NIE" << endl;
}
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgpib29sIGlzX3ByaW1lKGludCBuKQp7CiAgICBmb3IgKGludCBpID0gMjsgaSA8IG47ICsraSkgewogICAgICAgIGlmIChuICUgaSA9PSAwKSB7CiAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICB9CiAgICB9CiAgICByZXR1cm4gbiA+IDE7Cn0KCmludCBtYWluKCkKewogICAgaW50IHQ7CiAgICBjaW4gPj4gdDsKICAgIHdoaWxlICh0LS0pIHsKICAgICAgICBpbnQgczsKICAgICAgICBjaW4gPj4gczsKICAgICAgICBib29sIGYgPSBmYWxzZTsKICAgICAgICBmb3IgKGludCB4ID0gMTsgeCA8IHM7ICsreCkgewogICAgICAgICAgICBpbnQgeSA9IHMgLSB4OwogICAgICAgICAgICBpZiAoaXNfcHJpbWUoeCkgJiYgaXNfcHJpbWUoeSkpIHsKICAgICAgICAgICAgICAgIGNvdXQgPDwgIlRBSyAiIDw8IHggPDwgIiAiIDw8IHkgPDwgZW5kbDsKICAgICAgICAgICAgICAgIGYgPSB0cnVlOwogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKCFmKSB7CiAgICAgICAgICAgIGNvdXQgPDwgIk5JRSIgPDwgZW5kbDsKICAgICAgICB9CiAgICB9CiAgICByZXR1cm4gMDsKfQ==