406182: GYM102302 G Left Stack Game

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

G. Left Stack Gametime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Tomaz and Danftito are playing a game with 3 stacks of rocks, each with a, b and c rocks respectively. Each turn, a player must take from 1 to m rocks from a stack, but they can't empty a stack if there are rocks in any stack to the left. The player that removes the last rock wins. If Tomaz goes first and they take turns playing, determine who will win the game if both players play optimally.

Input

The input contains one line with four integers: m (1 ≤ m ≤ 1018) representing the maximum amount of rocks to be removed in a single turn, a, b and c (1 ≤ a, b, c ≤ 1018) each representing how many rocks there are initially in the first, second and third stacks respectively.

Output

Print "Tomaz" if Tomaz will win the game, and "Danftito" otherwise.

ExampleInput
3 1 1 1
Output
Tomaz

Source/Category

加入题单

算法标签: