atcoder#ARC155D. [ARC155D] Avoid Coprime Game
[ARC155D] Avoid Coprime Game
Score : points
Problem Statement
For two non-negative integers and , let be the greatest common divisor of and (for , let ).
There are integers on the blackboard, and the -th integer is . The greatest common divisor of these integers is .
Takahashi and Aoki will play a game against each other. After initializing an integer to , they will take turns performing the following operation, with Takahashi going first.
- Choose a number on the blackboard such that , erase it, and replace with .
The first player unable to play loses.
For each , determine the winner when Takahashi chooses the -th integer on the blackboard in his first turn, and then both players play optimally.
Constraints
- The greatest common divisor of the integers is .
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print lines. The -th line should contain the winner's name, Takahashi
or Aoki
, when Takahashi chooses the -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 in his first turn, Aoki can then choose the second integer to make . 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