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