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