s=list(input())
s1="".join(s[:2])
s2="".join(s[2:])
if 0<int(s1)<=12 and 0<int(s2)<=12:
    print("AMBIGUOUS")
elif 0<int(s1)<=12 and (int(s2)>12 or int(s2)==0):
    print("MMYY")
elif 0<int(s2)<=12 and (int(s1)>12 or int(s1)==0):
    print("YYMM")
else:
    print("NA") s=list(input()) s list(input()) list input() input s1="".join(s[:2]) s1 "".join(s[:2]) "".join "" join s[:2] s :2 2 s2="".join(s[2:]) s2 "".join(s[2:]) "".join "" join s[2:] s 2: 2 if 0<int(s1)<=12 and 0<int(s2)<=12:
    print("AMBIGUOUS")
elif 0<int(s1)<=12 and (int(s2)>12 or int(s2)==0):
    print("MMYY")
elif 0<int(s2)<=12 and (int(s1)>12 or int(s1)==0):
    print("YYMM")
else:
    print("NA") 0<int(s1)<=12 and 0<int(s2)<=12 0<int(s1)<=12 0<int(s1) 0 int(s1) int s1 12 0<int(s2)<=12 0<int(s2) 0 int(s2) int s2 12 print("AMBIGUOUS") print "AMBIGUOUS" elif 0<int(s1)<=12 and (int(s2)>12 or int(s2)==0):
    print("MMYY") 0<int(s1)<=12 and (int(s2)>12 or int(s2)==0) 0<int(s1)<=12 0<int(s1) 0 int(s1) int s1 12 int(s2)>12 or int(s2)==0 int(s2)>12 int(s2) int s2 12 int(s2)==0 int(s2) int s2 0 print("MMYY") print "MMYY" elif 0<int(s2)<=12 and (int(s1)>12 or int(s1)==0):
    print("YYMM") 0<int(s2)<=12 and (int(s1)>12 or int(s1)==0) 0<int(s2)<=12 0<int(s2) 0 int(s2) int s2 12 int(s1)>12 or int(s1)==0 int(s1)>12 int(s1) int s1 12 int(s1)==0 int(s1) int s1 0 print("YYMM") print "YYMM" print("NA") print "NA" s=list(input()) list(input()) s s2="".join(s[2:]) "".join(s[2:]) s2 s1="".join(s[:2]) "".join(s[:2]) s1
s=list(input())
s1="".join(s[:2])
s2="".join(s[2:])
if 0<int(s1)<=12 and 0<int(s2)<=12:
    print("AMBIGUOUS")
elif 0<int(s1)<=12 and (int(s2)>12 or int(s2)==0):
    print("MMYY")
elif 0<int(s2)<=12 and (int(s1)>12 or int(s1)==0):
    print("YYMM")
else:
    print("NA")