#include<bits/stdc++.h>
#define ONLINE_JUGE
#ifdef ONLINE_JUGE
#ifdef _DEBUG
#endif // _DEBUG
#endif // ONLINE_JUGE
#ifdef _DEBUG
#define ll(x) << x
#define ls ll(", ")
#define ln(n, x) ll(n) ll(": ") ll(x) ls
#define lv(x) ln(#x, x)
#define pp(x) cout x ll(flush);
#define pr(x) pp(ln("Line", __LINE__) x ll(endl))
#define dbg1(x) x
#else // _DEBUG
#define ll(x)
#define ls
#define ln(n, x)
#define lv(x)
#define pp(x) ;
#define pr(x) ;
#define dbg1(x)
#endif // _DEBUG
using namespace std;
#ifndef uint
typedef unsigned int uint;
#endif
bool is_leap(uint y) {
if (y % 400 == 0) {
return true;
} else if (y % 100 == 0) {
return false;
} else if (y % 4 == 0) {
return true;
} else {
return false;
}
}
/*
January: 31 days
February: 28 days and 29 in every leap year
March: 31 days
April: 30 days
May: 31 days
June: 30 days
July: 31 days
August: 31 days
September: 30 days
October: 31 days
November: 30 days
December: 31 days
*/
bool is_valid(uint d, uint m, uint y) {
if (m > 12) return false;
if (m == 1) return d <= 31;
else if (m == 2) return d <= (is_leap(y) ? 29 : 28);
else if (m == 3) return d <= 31;
else if (m == 4) return d <= 30;
else if (m == 5) return d <= 31;
else if (m == 6) return d <= 30;
else if (m == 7) return d <= 31;
else if (m == 8) return d <= 31;
else if (m == 9) return d <= 30;
else if (m == 10) return d <= 31;
else if (m == 11) return d <= 30;
else if (m == 12) return d <= 31;
return true;
}
int main() {
uint d, m, y;
cin >> d >> m >> y;
if (is_valid(d, m, y)) {
cout << "TAK" << "\n";
} else {
cout << "NIE" << "\n";
}
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KI2RlZmluZSBPTkxJTkVfSlVHRQojaWZkZWYgT05MSU5FX0pVR0UKI2lmZGVmIF9ERUJVRwojZW5kaWYgLy8gX0RFQlVHCiNlbmRpZiAvLyBPTkxJTkVfSlVHRQojaWZkZWYgX0RFQlVHCiNkZWZpbmUgbGwoeCkgPDwgeAojZ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