atcoder#ARC155D. [ARC155D] Avoid Coprime Game

[ARC155D] Avoid Coprime Game

Score : 800800 points

Problem Statement

For two non-negative integers xx and yy, let gcd(x,y)\gcd(x,y) be the greatest common divisor of xx and yy (for x=0x=0, let gcd(x,y)=gcd(y,x)=y\gcd(x,y)=\gcd(y,x)=y).

There are NN integers on the blackboard, and the ii-th integer is AiA_i. The greatest common divisor of these NN integers is 11.

Takahashi and Aoki will play a game against each other. After initializing an integer GG to 00, they will take turns performing the following operation, with Takahashi going first.

  • Choose a number aa on the blackboard such that gcd(G,a)1\gcd(G,a)\neq 1, erase it, and replace GG with gcd(G,a)\gcd(G,a).

The first player unable to play loses.

For each i (1iN)i\ (1\leq i \leq N), determine the winner when Takahashi chooses the ii-th integer on the blackboard in his first turn, and then both players play optimally.

Constraints

  • 2N2×1052 \leq N \leq 2 \times 10^5
  • 2Ai2×1052 \leq A_i \leq 2 \times 10^5
  • The greatest common divisor of the NN integers Ai (1iN)A_i \ (1\leq i \leq N) is 11.
  • All values in the input are integers.

Input

The input is given from Standard Input in the following format:

NN

A1A_1 A2A_2 \dots ANA_N

Output

Print NN lines. The ii-th line should contain the winner's name, Takahashi or Aoki, when Takahashi chooses the ii-th integer on the blackboard in his first turn, and then both players play optimally.

4
2 3 4 6
Takahashi
Aoki
Takahashi
Aoki

For instance, when Takahashi chooses the fourth integer A4=6A_4=6 in his first turn, Aoki can then choose the second integer A2=3A_2=3 to make G=3G=3. Now, Takahashi cannot choose anything, so Aoki wins. Thus, the fourth line should contain Aoki.

4
2 155 155 155
Takahashi
Takahashi
Takahashi
Takahashi

The blackboard may contain the same integer multiple times.

20
2579 25823 32197 55685 73127 73393 74033 95252 104289 114619 139903 144912 147663 149390 155806 169494 175264 181477 189686 196663
Takahashi
Aoki
Takahashi
Aoki
Takahashi
Takahashi
Takahashi
Takahashi
Aoki
Takahashi
Takahashi
Aoki
Aoki
Aoki
Aoki
Aoki
Takahashi
Takahashi
Aoki
Takahashi