S = eval(input())

mm = ["0"+str(x) for x in range(1,10)]+["10","11","12"]

mmyy = (S[:2] in mm)

yymm = (S[2:] in mm)

a = "NA"



if yymm and mmyy:

  a = "AMBIGUOUS"

elif yymm:

  a = "YYMM"

elif mmyy:

  a = "MMYY"

  

print(a)
S = eval(input())

L = int(S[:2])

R = int(S[2:])



if 1<=L<=12 and 1<=R<=12:

  print("AMBIGUOUS")

elif 1<=L<=12:

  print("MMYY")

elif 1<=R<=12:

  print("YYMM")

else:

  print("NA")
S = eval(input())
mm = ["0" + str(x) for x in range(1, 10)] + ["10", "11", "12"]
mmyy = S[:2] in mm
yymm = S[2:] in mm
a = "NA"
if yymm and mmyy:
    a = "AMBIGUOUS"
elif yymm:
    a = "YYMM"
elif mmyy:
    a = "MMYY"
print(a)

S = eval(input())
L = int(S[:2])
R = int(S[2:])
if 1 <= L <= 12 and 1 <= R <= 12:
    print("AMBIGUOUS")
elif 1 <= L <= 12:
    print("MMYY")
elif 1 <= R <= 12:
    print("YYMM")
else:
    print("NA")

-mm = ["0" + str(x) for x in range(1, 10)] + ["10", "11", "12"] -mmyy = S[:2] in mm -yymm = S[2:] in mm -a = "NA" -if yymm and mmyy: -    a = "AMBIGUOUS" -elif yymm: -    a = "YYMM" -elif mmyy: -    a = "MMYY" -print(a) +L = int(S[:2]) +R = int(S[2:]) +if 1 <= L <= 12 and 1 <= R <= 12: +    print("AMBIGUOUS") +elif 1 <= L <= 12: +    print("MMYY") +elif 1 <= R <= 12: +    print("YYMM") +else: +    print("NA")