S = input()
num1 = int(S[:2])
num2 = int(S[2:])

if 1 <= num1 <= 12 and 1 <=  num2 <= 12:
    ans = "AMBIGUOUS"
elif 1 <= num1 <= 12 and (num2 == 0 or 12 < num2):
    ans = "MMYY"
elif (num1 == 0 or 12 < num1) and 1 <=  num2 <= 12:
    ans = "YYMM"
else:
    ans = "NA"
print(ans) S = input() S input() input num1 = int(S[:2]) num1 int(S[:2]) int S[:2] S :2 2 num2 = int(S[2:]) num2 int(S[2:]) int S[2:] S 2: 2 if 1 <= num1 <= 12 and 1 <=  num2 <= 12:
    ans = "AMBIGUOUS"
elif 1 <= num1 <= 12 and (num2 == 0 or 12 < num2):
    ans = "MMYY"
elif (num1 == 0 or 12 < num1) and 1 <=  num2 <= 12:
    ans = "YYMM"
else:
    ans = "NA" 1 <= num1 <= 12 and 1 <=  num2 <= 12 1 <= num1 <= 12 1 <= num1 1 num1 12 1 <=  num2 <= 12 1 <=  num2 1 num2 12 ans = "AMBIGUOUS" ans "AMBIGUOUS" elif 1 <= num1 <= 12 and (num2 == 0 or 12 < num2):
    ans = "MMYY" 1 <= num1 <= 12 and (num2 == 0 or 12 < num2) 1 <= num1 <= 12 1 <= num1 1 num1 12 num2 == 0 or 12 < num2 num2 == 0 num2 0 12 < num2 12 num2 ans = "MMYY" ans "MMYY" elif (num1 == 0 or 12 < num1) and 1 <=  num2 <= 12:
    ans = "YYMM" (num1 == 0 or 12 < num1) and 1 <=  num2 <= 12 num1 == 0 or 12 < num1 num1 == 0 num1 0 12 < num1 12 num1 1 <=  num2 <= 12 1 <=  num2 1 num2 12 ans = "YYMM" ans "YYMM" ans = "NA" ans "NA" print(ans) print ans S = input() input() S num2 = int(S[2:]) int(S[2:]) num2 ans = "MMYY" "MMYY" ans ans = "YYMM" "YYMM" ans ans = "NA" "NA" ans ans = "AMBIGUOUS" "AMBIGUOUS" ans num1 = int(S[:2]) int(S[:2]) num1
S = input()
num1 = int(S[:2])
num2 = int(S[2:])

if 1 <= num1 <= 12 and 1 <=  num2 <= 12:
    ans = "AMBIGUOUS"
elif 1 <= num1 <= 12 and (num2 == 0 or 12 < num2):
    ans = "MMYY"
elif (num1 == 0 or 12 < num1) and 1 <=  num2 <= 12:
    ans = "YYMM"
else:
    ans = "NA"
print(ans)
