#abc354e. E - Remove Pairs

E - Remove Pairs

Score : 475475 points

问题陈述

高桥和青木正在使用NN张卡片玩一个游戏。第ii张卡片的正面写着AiA_i,背面写着BiB_i。最初,这NN张卡片被放在桌子上。高桥先开始,两位玩家轮流执行以下操作:

  • 从桌子上选择一对卡片,使得它们的正面数字相同或背面数字相同,然后将这两张卡片从桌子上移除。如果不存在这样的一对卡片,则玩家无法执行操作。

如果玩家无法执行操作,则输掉游戏,另一位玩家获胜。如果两位玩家都以最优策略进行游戏,请确定谁将获胜。

以上为大语言模型 kimi 翻译,仅供参考。

Problem Statement

Takahashi and Aoki are playing a game using NN cards. The front side of the ii-th card has AiA_i written on it, and the back side has BiB_i written on it. Initially, the NN cards are laid out on the table. With Takahashi going first, the two players take turns performing the following operation:

  • Choose a pair of cards from the table such that either the numbers on their front sides are the same or the numbers on their back sides are the same, and remove these two cards from the table. If no such pair of cards exists, the player cannot perform the operation.

The player who is first to be unable to perform the operation loses, and the other player wins. Determine who wins if both players play optimally.

Constraints

  • 1N181 \leq N \leq 18
  • 1Ai,Bi1091 \leq A_i, B_i \leq 10^9
  • All input values are integers.

Input

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

NN

A1A_1 B1B_1

A2A_2 B2B_2

\vdots

ANA_N BNB_N

Output

Print Takahashi if Takahashi wins when both players play optimally, and Aoki otherwise.

Sample Input 1

5
1 9
2 5
4 9
1 4
2 5

Sample Output 1

Aoki

If Takahashi first removes

  • the first and third cards: Aoki can win by removing the second and fifth cards.

  • the first and fourth cards: Aoki can win by removing the second and fifth cards.

  • the second and fifth cards: Aoki can win by removing the first and third cards.

These are the only three pairs of cards Takahashi can remove in his first move, and Aoki can win in all cases. Therefore, the answer is Aoki.

Sample Input 2

9
3 2
1 7
4 1
1 8
5 2
9 8
2 1
6 8
5 2

Sample Output 2

Takahashi