s=input()

first = int(s[:2])
second = int(s[2:])

if (first>0) and (first<13) and (second>0) and (second<13):
    print("AMBIGUOUS")
elif (first>0) and (first<13) and ((second==0) or (second>=13)):
    print("MMYY")
elif (second>0) and (second<13) and ((first==0) or (first>=13)):
    print("YYMM")
else:
    print("NA") s=input() s input() input first = int(s[:2]) first int(s[:2]) int s[:2] s :2 2 second = int(s[2:]) second int(s[2:]) int s[2:] s 2: 2 if (first>0) and (first<13) and (second>0) and (second<13):
    print("AMBIGUOUS")
elif (first>0) and (first<13) and ((second==0) or (second>=13)):
    print("MMYY")
elif (second>0) and (second<13) and ((first==0) or (first>=13)):
    print("YYMM")
else:
    print("NA") (first>0) and (first<13) and (second>0) and (second<13) (first>0) and (first<13) and (second>0) (first>0) and (first<13) first>0 first 0 first<13 first 13 second>0 second 0 second<13 second 13 print("AMBIGUOUS") print "AMBIGUOUS" elif (first>0) and (first<13) and ((second==0) or (second>=13)):
    print("MMYY") (first>0) and (first<13) and ((second==0) or (second>=13)) (first>0) and (first<13) first>0 first 0 first<13 first 13 (second==0) or (second>=13) second==0 second 0 second>=13 second 13 print("MMYY") print "MMYY" elif (second>0) and (second<13) and ((first==0) or (first>=13)):
    print("YYMM") (second>0) and (second<13) and ((first==0) or (first>=13)) (second>0) and (second<13) second>0 second 0 second<13 second 13 (first==0) or (first>=13) first==0 first 0 first>=13 first 13 print("YYMM") print "YYMM" print("NA") print "NA" second = int(s[2:]) int(s[2:]) second first = int(s[:2]) int(s[:2]) first s=input() input() s
s=input()

first = int(s[:2])
second = int(s[2:])

if (first>0) and (first<13) and (second>0) and (second<13):
    print("AMBIGUOUS")
elif (first>0) and (first<13) and ((second==0) or (second>=13)):
    print("MMYY")
elif (second>0) and (second<13) and ((first==0) or (first>=13)):
    print("YYMM")
else:
    print("NA")