Score : $500$ points
The Takahashi Dictionary lists $N$ words; the $i$-th word $(1 \leq i \leq N)$ is $s_i$.
Using this dictionary, Takahashi and Aoki will play $3$-shiritori, which goes as follows.
Takahashi
, the next player can say ship
or shield
along with other choices, but not Aoki
, sing
, or his
.ShIp
following Takahashi
.For each $i$ $(1 \leq i \leq N)$, determine who will win when Takahashi starts the game by saying the word $s_i$. Here, we assume that both players play optimally. More specifically, each player gives first priority to avoiding his loss and second priority to defeating the opponent.
Input is given from Standard Input in the following format:
$N$ $s_1$ $s_2$ $\vdots$ $s_N$
Print $N$ lines. The $i$-th line $(1 \leq i \leq N)$ should contain Takahashi
if Takahashi wins when Takahashi starts the game by saying the word $s_i$, Aoki
if Aoki wins in that scenario, and Draw
if the game continues forever with neither of them losing in that scenario.
3 abcd bcda ada
Aoki Takahashi Draw
When Takahashi starts the game by saying abcd
, Aoki will say bcda
next, and Takahashi will then have no word to say, resulting in Aoki's win. Thus, we should print Aoki
.
When Takahashi starts the game by saying bcda
, Aoki will have no word to say, resulting in Takahashi win. Thus, we should print Takahashi
.
When Takahashi starts the game by saying ada
, both players will repeat ada
and never end the game. Thus, we should print Draw
. Note that they can use the same word any number of times.
1 ABC
Draw
5 eaaaabaa eaaaacaa daaaaaaa eaaaadaa daaaafaa
Takahashi Takahashi Takahashi Aoki Takahashi