#ifdef ONLINE_JUDGE #define NDEBUG #endif #if defined(__GNUC__) && !defined(__clang__) // #pragma GCC optimize("O3") // #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #pragma GCC optimize("unroll-loops") #endif // workaround for codeforces g++20 compiler bug #if __cplusplus >= 202002L #define _EXT_CODECVT_SPECIALIZATIONS_H #define _EXT_ENC_FILEBUF_H #endif // #include using namespace std; #if __cplusplus >= 202002L namespace R = ranges; namespace V = views; #endif using i64 = long long; using u64 = unsigned long long; using f64 = double; using uz = size_t; using u32 = uint32_t; using itn = int; template using ve = vector; template using a2 = array; template using HashMap = unordered_map; template using HashSet = unordered_set; template > using PQ = std::priority_queue, C>; template > using miPQ = std::priority_queue, C>; #define mt make_tuple #define mp make_pair #ifdef LOCAL #include "debug_template.cpp" #else #define debug(...) #define debugArr(...) #endif // constexpr array dirs{-1, 0, 1, 0, -1}; // constexpr char nesw[4]{'N', 'E', 'S', 'W'}; // constexpr int M = 1e9 + 7; void cln() { cout << '\n'; } constexpr char ln = '\n'; array dp; bitset<2001> in; int main() { #ifndef LOCAL ios::sync_with_stdio(0), cin.tie(0); #endif // int n; cin >> n; ve pxor(n); cin >> pxor[0]; for (int i = 1; i < n; ++i) { cin >> pxor[i]; pxor[i] ^= pxor[i - 1]; } dp[n] = 0; for (int i = n - 1; i >= 0; --i) { const int prev = i ? pxor[i - 1] : 0; in.set(); for (int j = i; j < n; ++j) { int cur = pxor[j] ^ dp[j + 1] ^ prev; if (cur < in.size()) { in.reset(cur); } } dp[i] = in._Find_first(); } cout << (dp[0] ? "Takahashi" : "Takanashi") << ln; }