s=input()

if 12<int(s[:2]) or 0==int(s[:2]):
    if 12>=int(s[2:])>=1:
        print("YYMM")
    else:
        print("NA")
elif 1<=int(s[:2])<=12:
    if 12>=int(s[2:])>=1:
        print("AMBIGUOUS")
    else:
        print("MMYY")
     s=input() s input() input if 12<int(s[:2]) or 0==int(s[:2]):
    if 12>=int(s[2:])>=1:
        print("YYMM")
    else:
        print("NA")
elif 1<=int(s[:2])<=12:
    if 12>=int(s[2:])>=1:
        print("AMBIGUOUS")
    else:
        print("MMYY")
     12<int(s[:2]) or 0==int(s[:2]) 12<int(s[:2]) 12 int(s[:2]) int s[:2] s :2 2 0==int(s[:2]) 0 int(s[:2]) int s[:2] s :2 2 if 12>=int(s[2:])>=1:
        print("YYMM")
    else:
        print("NA") 12>=int(s[2:])>=1 12>=int(s[2:]) 12 int(s[2:]) int s[2:] s 2: 2 1 print("YYMM") print "YYMM" print("NA") print "NA" elif 1<=int(s[:2])<=12:
    if 12>=int(s[2:])>=1:
        print("AMBIGUOUS")
    else:
        print("MMYY")
     1<=int(s[:2])<=12 1<=int(s[:2]) 1 int(s[:2]) int s[:2] s :2 2 12 if 12>=int(s[2:])>=1:
        print("AMBIGUOUS")
    else:
        print("MMYY")
     12>=int(s[2:])>=1 12>=int(s[2:]) 12 int(s[2:]) int s[2:] s 2: 2 1 print("AMBIGUOUS") print "AMBIGUOUS" print("MMYY") print "MMYY" s=input() input() s
s=input()

if 12<int(s[:2]) or 0==int(s[:2]):
    if 12>=int(s[2:])>=1:
        print("YYMM")
    else:
        print("NA")
elif 1<=int(s[:2])<=12:
    if 12>=int(s[2:])>=1:
        print("AMBIGUOUS")
    else:
        print("MMYY")
    
