atcoder#ABC195E. [ABC195E] Lucky 7 Battle

[ABC195E] Lucky 7 Battle

Score : 500500 points

Problem Statement

We have a string SS of length NN consisting of 0, \ldots, 9, and a string XX of length NN consisting of A and T. Additionally, there is a string TT, which is initialized to an empty string.

Takahashi and Aoki will play a game using these. The game consists of NN rounds. In the ii-th round (1iN)(1\leq i \leq N), the following happens:

  • If XiX_i is A, Aoki does the operation below; if XiX_i is T, Takahashi does it.
  • Operation: append SiS_i or 0 at the end of TT.

After NN operations, TT will be a string of length NN consisting of 0, \ldots, 9. If TT is a multiple of 77 as a base-ten number (after removing leading zeros), Takahashi wins; otherwise, Aoki wins.

Determine the winner of the game when the two players play optimally.

Constraints

  • 1N2×1051 \leq N \leq 2\times 10^5
  • SS and XX have a length of NN each.
  • SS consists of 0, \ldots, 9.
  • XX consists of A and T.

Input

Input is given from Standard Input in the following format:

NN

SS

XX

Output

If Takahashi wins when the two players play optimally, print Takahashi; if Aoki wins, print Aoki.

2
35
AT
Takahashi

In the 11-st round, Aoki appends 3 or 0 at the end of TT. In the 22-nd round, Takahashi appends 5 or 0 at the end of TT.

If Aoki appends 3, Takahashi can append 5 to make TT 35, a multiple of 77.

If Aoki appends 0, Takahashi can append 0 to make TT 00, a multiple of 77.

Thus, Takahashi can always win.

5
12345
AAAAT
Aoki
5
67890
TTTTA
Takahashi
5
12345
ATATA
Aoki