Three Three Three

시간 제한1초메모리 제한2048 MB

요약
0이 없는 숫자 문자열에서 두 사람이 번갈아 3의 배수인 연속 세 자리의 가운데 숫자를 지우며, 더 이상 움직일 수 없는 사람이 진다.
난이도

보통10점 중 7점

유형
게임 이론, 문자열, 누적 합, 조합론
정답자
아직 제출이 없습니다

문제

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 will take turns alternatingly starting with Anda.

During one turn, the player of that turn must do the following procedure: First, choose three consecutive digits in NN such that if the digits are considered as a three-digit integer, it must be divisible by 33. Then, erase the middle digit of the chosen digits and concatenate the rest, so the number of digits in NN decreases by one.

If there is no valid move for the player of that turn, then the player loses. Assuming both players are playing optimally, determine the winner of the game.

입력

This problem is a multi-case problem. The first line consists of an integer TT (1≤T≤1001 ≤ T ≤ 100) which represents the number of test cases.

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

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

출력

For each test case, output a single string in a single line representing the winner of the game if both players play optimally. If Anda, the first player, wins the game, output Anda. Otherwise, output Kamu.

예제1

  1. 예제 1

    입력
    5
    19823
    2651265
    9
    73
    123
    
    예상 출력
    Anda
    Kamu
    Kamu
    Kamu
    Anda