from functools import lru_cache def main(): import sys N = list(map(int, sys.stdin.readline().split())) S = sum(N) N_tuple = tuple(N) @lru_cache(maxsize=None) def play(piles, taro_hand, turn): sum_piles = sum(piles) jiro_hand = S - taro_hand - sum_piles if sum_piles == 0: if taro_hand > jiro_hand: return 1 # Taro wins elif taro_hand < jiro_hand: return -1 # Jiro wins else: return 0 # Draw if turn: # Taro's turn; he wants to maximize the outcome max_score = -2 # worst case for i in range(4): for k in range(1, 4): if piles[i] >= k: new_piles = list(piles) new_piles[i] -= k new_piles = tuple(new_piles) new_taro = taro_hand + k new_jiro = jiro_hand # Check if this move empties the pile if new_piles[i] == 0: stolen = (new_jiro + 1) // 2 new_taro += stolen new_jiro -= stolen # Recurse score = play(new_piles, new_taro, False) if score > max_score: max_score = score return max_score if max_score != -2 else 0 else: # Jiro's turn; he wants to minimize the outcome min_score = 2 # worst case for i in range(4): for k in range(1, 4): if piles[i] >= k: new_piles = list(piles) new_piles[i] -= k new_piles = tuple(new_piles) new_jiro = jiro_hand + k new_taro = taro_hand # Check if this move empties the pile if new_piles[i] == 0: stolen = (new_taro + 1) // 2 new_jiro += stolen new_taro -= stolen # Recurse score = play(new_piles, new_taro, True) if score < min_score: min_score = score return min_score if min_score != 2 else 0 result = play(N_tuple, 0, True) if result > 0: print("Taro") elif result < 0: print("Jiro") else: print("Draw") if __name__ == "__main__": main()