#include<bits/stdc++.h>
using namespace std;
struct robot {
int mj, ll;
} rob[200005], res;
bool cmp(robot a, robot b) {
return a.mj > b.mj;
}
int main() {
int n;
cin >> n;
if (n == 1) {
cout << "NIE";
return 0;
}
for (int i = 1; i <= n; i++) cin >> rob[i].mj >> rob[i].ll;
sort(rob + 1, rob + 1 + n, cmp);
int i = 1, j = 2, def = 0;
while (i <= n && j <= n) {
while (j <= n && rob[i].mj > rob[j].mj && rob[i].ll > rob[j].ll) {
j++;
def++;
}
i = j;
j = i + 1;
}
if ((n - def) & 1) cout << "NIE";
else cout << "TAK";
return 0;
}