10327: ABC354 —— E - Remove Pairs
[Creator : ]
Description
Takahashi and Aoki are playing a game using $N$ cards. The front side of the $i$-th card has $A_i$ written on it, and the back side has $B_i$ written on it. Initially, the $N$ 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.
- 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.
Input
The input is given from Standard Input in the following format:
```
$N$
$A_1$ $B_1$
$A_2$ $B_2$
$\vdots$
$A_N$ $B_N$
```
```
$N$
$A_1$ $B_1$
$A_2$ $B_2$
$\vdots$
$A_N$ $B_N$
```
Output
Print `Takahashi` if Takahashi wins when both players play optimally, and `Aoki` otherwise.
Constraints
- $1 \leq N \leq 18$
- $1 \leq A_i, B_i \leq 10^9$
- All input values are integers.
- $1 \leq A_i, B_i \leq 10^9$
- All input values are integers.
Sample 1 Input
5
1 9
2 5
4 9
1 4
2 5
Sample 1 Output
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.
Sample 2 Input
9
3 2
1 7
4 1
1 8
5 2
9 8
2 1
6 8
5 2
Sample 2 Output
Takahashi