#include <bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> using namespace std; //using namespace __gnu_pbds; #define st first #define nd second #define pb push_back #define popb pop_back #define mp make_pair #define all(x) x.begin(),x.end() #define sortall(x) sort(all(x)); #define deb(x) cout << #x << " = " << x << endl #define debv(x) cout << #x << ": "; for (int i = 0; i < (x).size(); i++) cout << (x)[i] << ' '; cout << endl #define PI 3.1415926535897932384626 #define fastio ios_base::sync_with_stdio(false); cin.tie(); cout.tie(); srand(time(NULL)); cout << fixed << setprecision(9) typedef pair< int ,int > pii; typedef pair< long long, long long > pll; typedef vector< pii > vii; typedef vector< pll > vll; typedef long long ll; typedef map< int, int > mii; typedef set< pii > sii; typedef set< int > si; typedef vector< int > vi; typedef vector< ll > vl; typedef long double ld; typedef pair< ld, ld > pld; typedef vector< pld > vpld; typedef unsigned long long ull; typedef long long ll; //typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; //ordered_set t; //t.insert(val); //t.find_by_order(i) - returns iterator to the i-th element in set //t.order_of_key(i) - index of value i const ll mod = 1e9 + 7; /// 1 000 000 007 const ll mod2 = 119 << 23 | 1; /// 998244353 const ll mod3 = 467093870598391; /// big prime int inf = 1e9 + 7; ll INF = 1e16 + 9; ///tagliatelle here /// ll power (ll x, ll y); ll inv (ll x); bool isPrime (ll x); ll gcd (ll x, ll y); //================================================================================ const int nax = 2e5 + 13; void prep(){ } void solve(){ int n; cin >> n; set<string> codes[2]; string s; for(int i = 0; i < n; i++){ cin >> s; if(s[0] == '5' && codes[0].count(s)){ codes[1].insert(s); } codes[0].insert(s); } if(codes[0].size() == 15 && codes[1].size() == 3){ cout << "TAK" << endl; }else{ cout << "NIE" << endl; } } int main(){ ///use cin and printf if you wanna see some REAL SPEED //#ifndef ONLINE_JUDGE // freopen("in.txt", "r", stdin); // freopen("out.txt", "w", stdout); //#endif fastio; int T = 1; prep(); //cin >> T; for(int i = 1; i <= T; i++){ //cout << "test number " << i << endl; solve(); //cout << "end" << endl; } return 0; } ll power (ll x, ll y) { ll res = 1ll; x %= mod; if (x == 0) return 0; while (y > 0) { if (y & 1) res = (res * x) % mod; y = y >> 1ll; x = (x * x) % mod; } return res; } bool isPrime (ll x) { if (x == 1) return false; for (ll i = 2ll; i * i <= x; i++) { if (x % i == 0) return false; } return true; } ll gcd (ll x, ll y) { if (!y) return x; return gcd (y, x % y); } /* __builtin_popcount __builtin_ctz __builtin_clz */
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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | #include <bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> using namespace std; //using namespace __gnu_pbds; #define st first #define nd second #define pb push_back #define popb pop_back #define mp make_pair #define all(x) x.begin(),x.end() #define sortall(x) sort(all(x)); #define deb(x) cout << #x << " = " << x << endl #define debv(x) cout << #x << ": "; for (int i = 0; i < (x).size(); i++) cout << (x)[i] << ' '; cout << endl #define PI 3.1415926535897932384626 #define fastio ios_base::sync_with_stdio(false); cin.tie(); cout.tie(); srand(time(NULL)); cout << fixed << setprecision(9) typedef pair< int ,int > pii; typedef pair< long long, long long > pll; typedef vector< pii > vii; typedef vector< pll > vll; typedef long long ll; typedef map< int, int > mii; typedef set< pii > sii; typedef set< int > si; typedef vector< int > vi; typedef vector< ll > vl; typedef long double ld; typedef pair< ld, ld > pld; typedef vector< pld > vpld; typedef unsigned long long ull; typedef long long ll; //typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; //ordered_set t; //t.insert(val); //t.find_by_order(i) - returns iterator to the i-th element in set //t.order_of_key(i) - index of value i const ll mod = 1e9 + 7; /// 1 000 000 007 const ll mod2 = 119 << 23 | 1; /// 998244353 const ll mod3 = 467093870598391; /// big prime int inf = 1e9 + 7; ll INF = 1e16 + 9; ///tagliatelle here /// ll power (ll x, ll y); ll inv (ll x); bool isPrime (ll x); ll gcd (ll x, ll y); //================================================================================ const int nax = 2e5 + 13; void prep(){ } void solve(){ int n; cin >> n; set<string> codes[2]; string s; for(int i = 0; i < n; i++){ cin >> s; if(s[0] == '5' && codes[0].count(s)){ codes[1].insert(s); } codes[0].insert(s); } if(codes[0].size() == 15 && codes[1].size() == 3){ cout << "TAK" << endl; }else{ cout << "NIE" << endl; } } int main(){ ///use cin and printf if you wanna see some REAL SPEED //#ifndef ONLINE_JUDGE // freopen("in.txt", "r", stdin); // freopen("out.txt", "w", stdout); //#endif fastio; int T = 1; prep(); //cin >> T; for(int i = 1; i <= T; i++){ //cout << "test number " << i << endl; solve(); //cout << "end" << endl; } return 0; } ll power (ll x, ll y) { ll res = 1ll; x %= mod; if (x == 0) return 0; while (y > 0) { if (y & 1) res = (res * x) % mod; y = y >> 1ll; x = (x * x) % mod; } return res; } bool isPrime (ll x) { if (x == 1) return false; for (ll i = 2ll; i * i <= x; i++) { if (x % i == 0) return false; } return true; } ll gcd (ll x, ll y) { if (!y) return x; return gcd (y, x % y); } /* __builtin_popcount __builtin_ctz __builtin_clz */ |