#include <bits/stdc++.h>
using namespace std;
const int MAXA = 1000000000;
vector<int> A;
vector<bool> L, R;
int main()
{
int n;
cin >> n;
A.resize(n + 2);
A[0] = 0;
for (int i = 1; i <= n; ++i) {
cin >> A[i];
}
A[n + 1] = MAXA + 1;
L.resize(n + 2);
L[0] = true;
for (int i = 1; i <= n + 1; ++i) {
L[i] = L[i - 1] && (A[i - 1] < A[i]);
}
R.resize(n + 2);
R[n + 1] = true;
for (int i = n; i >= 0; --i) {
R[i] = R[i + 1] && (A[i] < A[i + 1]);
}
for (int i = 1; i <= n; ++i) {
if (!L[i - 1] || !R[i + 1]) {
continue;
}
for (int a = A[i - 1] + 1; a < A[i + 1]; ++a) {
if (a != A[i]) {
cout << "TAK " << i << " " << a << endl;
return 0;
}
}
}
cout << "NIE" << endl;
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgpjb25zdCBpbnQgTUFYQSA9IDEwMDAwMDAwMDA7Cgp2ZWN0b3I8aW50PiBBOwp2ZWN0b3I8Ym9vbD4gTCwgUjsKCmludCBtYWluKCkKewogICAgaW50IG47CiAgICBjaW4gPj4gbjsKICAgIEEucmVzaXplKG4gKyAyKTsKICAgIEFbMF0gPSAwOwogICAgZm9yIChpbnQgaSA9IDE7IGkgPD0gbjsgKytpKSB7CiAgICAgICAgY2luID4+IEFbaV07CiAgICB9CiAgICBBW24gKyAxXSA9IE1BWEEgKyAxOwogICAgTC5yZXNpemUobiArIDIpOwogICAgTFswXSA9IHRydWU7CiAgICBmb3IgKGludCBpID0gMTsgaSA8PSBuICsgMTsgKytpKSB7CiAgICAgICAgTFtpXSA9IExbaSAtIDFdICYmIChBW2kgLSAxXSA8IEFbaV0pOwogICAgfQogICAgUi5yZXNpemUobiArIDIpOwogICAgUltuICsgMV0gPSB0cnVlOwogICAgZm9yIChpbnQgaSA9IG47IGkgPj0gMDsgLS1pKSB7CiAgICAgICAgUltpXSA9IFJbaSArIDFdICYmIChBW2ldIDwgQVtpICsgMV0pOwogICAgfQogICAgZm9yIChpbnQgaSA9IDE7IGkgPD0gbjsgKytpKSB7CiAgICAgICAgaWYgKCFMW2kgLSAxXSB8fCAhUltpICsgMV0pIHsKICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgfQogICAgICAgIGZvciAoaW50IGEgPSBBW2kgLSAxXSArIDE7IGEgPCBBW2kgKyAxXTsgKythKSB7CiAgICAgICAgICAgIGlmIChhICE9IEFbaV0pIHsKICAgICAgICAgICAgICAgIGNvdXQgPDwgIlRBSyAiIDw8IGkgPDwgIiAiIDw8IGEgPDwgZW5kbDsKICAgICAgICAgICAgICAgIHJldHVybiAwOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfQogICAgY291dCA8PCAiTklFIiA8PCBlbmRsOwogICAgcmV0dXJuIDA7Cn0=