#include typedef long long ll; typedef unsigned long long ull; #define FOR(i,a,b) for(int (i)=(a);i<(b);i++) #define REP(i,n) FOR(i,0,n) #define RANGE(vec) (vec).begin(),(vec).end() using namespace std; class TakeTrump { public: map,int> memo; int grundy(const vector& n) { if (memo.count(n)) return memo[n]; set S; auto N = n; REP(i,4) FOR(j,1,N[i]+1) { N[i] -= j; S.insert(grundy(N)); N[i] += j; } int res = 0; while (S.count(res)) ++res; return memo[n] = res; } void solve(void) { // 結局最後にトランプをとった方の勝ちになる。 // 山がひとつだけのときを考えると // // 1~3 なら勝ち // 4 なら負け // 5 なら勝ち -> 4 へ遷移すればよい // 6 なら勝ち -> 4 // 7 なら勝ち -> 4 // 8 なら負け -> 5,6,7 // 9 なら勝ち -> 8 // 10 なら勝ち -> 8 // : // => 4 の倍数なら負け // // n 個の山があるとき // A が k (1<=k<=4) 個取るとき // B は 4-k 個取れば n-k-(4-k) = n-4 となり、 n%4 の結果は変わらない。 // よって初期状態(で勝敗が決するなら)の山の高さは 0,1,2,3 と考えてよい。 // // Nim として grandy 数を求めて解ける // vector n(4); REP(i,4) { cin>>n[i]; n[i] %= 4; } if (grundy(n)) cout<<"Taro"<solve(); delete obj; return 0; } #endif