#include using namespace std; #define _p(...) (void)printf(__VA_ARGS__) #define forr(x,arr) for(auto&& x:arr) #define _overload3(_1,_2,_3,name,...) name #define _rep2(i,n) _rep3(i,0,n) #define _rep3(i,a,b) for(int i=int(a);i=int(a);i--) #define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2,)(__VA_ARGS__) #define ALL(x) (x).begin(), (x).end() #define BIT(n) (1LL<<(n)) #define SZ(x) ((int)(x).size()) #define fst first #define snd second typedef long long ll; typedef vector vi;typedef vector vvi;typedef pair pii;typedef vector vpii; using T = int8_t; using State = array; T dp[15][15][15][15][60]; // node: 状態 // depth: 手番。偶数は先手、奇数は後手。 T search(const State& node, int depth) { T &RET = dp[node[0]][node[1]][node[2]][node[3]][node[4]]; if (RET < 0x3f) return RET; int cur = 4 + depth % 2; int nex = cur == 4 ? 5 : 4; bool e = 0; T mi = 100; T ma = -100; rep(i, 4) { rep(j, 1, 4) { if (node[i] >= j) { State next(node); next[i] -= j; next[cur] += j; if (next[i] == 0) { T half = (next[nex] + 1) / 2; next[cur] += half; next[nex] -= half; } e = 1; T result = search(next, depth+1); mi = min(mi, result); ma = max(ma, result); } } } if (!e) return RET = node[4] - node[5]; return RET = depth % 2 ? mi : ma; } void Main() { int N1, N2, N3, N4; scanf("%d%d%d%d", &N1, &N2, &N3, &N4); memset(dp, 0x3f, sizeof(dp)); State state; state[0] = N1; state[1] = N2; state[2] = N3; state[3] = N4; state[4] = state[5] = 0; int8_t score = search(state, 0); if (score > 0) puts("Taro"); else if (score < 0) puts("Jiro"); else puts("Draw"); } int main() { cin.tie(0); ios::sync_with_stdio(false); Main(); return 0; }