Under construction

Still being built. Things may change

Three Three Three

Time limit1sMemory limit2048 MB

Summary
Players alternately erase the middle digit of three consecutive digits that form a multiple of 3; find the winner under optimal play.
Level

Medium6 of 10

Topics
Game theory, Math, String
Solved
No attempts yet

Problem

Two players, Anda and Kamu, want to play a game. Initially, there is an integer NN that consists of only non-zero digits. Anda and Kamu take turns, starting with Anda.

On a turn, the player must do the following. First, choose three consecutive digits in NN such that, read as a three-digit integer, they are divisible by 33. Then erase the middle digit and concatenate the remaining two digits, so the number of digits in NN decreases by one.

If the player to move has no valid move, that player loses. Assuming both players play optimally, determine the winner.

Input

This problem has multiple test cases. The first line contains an integer TT (1≤T≤1001 \le T \le 100), the number of test cases.

Each test case is a single line containing an integer NN (1≤N<10100 0001 \le N < 10^{100\,000}). NN consists only of non-zero digits.

The sum of the number of digits of NN over all test cases does not exceed 100 000100\,000.

Output

For each test case, print one line with the winner if both players play optimally. If Anda, the first player, wins, print Anda. Otherwise, print Kamu.

Examples1

  1. Example 1

    Input
    5
    19823
    2651265
    9
    73
    123
    
    Expected output
    Anda
    Kamu
    Kamu
    Kamu
    Anda