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