s=input()
s1=int(s[0]+s[1])
s2=int(s[2]+s[3])
if (0<s1<13)and(0<s2<13):
    print("AMBIGUOUS")
elif (0<s1<13):
    print("MMYY")
elif (0<s2<13):
    print("YYMM")
else:
    print("NA") s=input() s input() input s1=int(s[0]+s[1]) s1 int(s[0]+s[1]) int s[0]+s[1] s[0] s 0 s[1] s 1 s2=int(s[2]+s[3]) s2 int(s[2]+s[3]) int s[2]+s[3] s[2] s 2 s[3] s 3 if (0<s1<13)and(0<s2<13):
    print("AMBIGUOUS")
elif (0<s1<13):
    print("MMYY")
elif (0<s2<13):
    print("YYMM")
else:
    print("NA") (0<s1<13)and(0<s2<13) 0<s1<13 0<s1 0 s1 13 0<s2<13 0<s2 0 s2 13 print("AMBIGUOUS") print "AMBIGUOUS" elif (0<s1<13):
    print("MMYY") 0<s1<13 0<s1 0 s1 13 print("MMYY") print "MMYY" elif (0<s2<13):
    print("YYMM") 0<s2<13 0<s2 0 s2 13 print("YYMM") print "YYMM" print("NA") print "NA" s2=int(s[2]+s[3]) int(s[2]+s[3]) s2 s=input() input() s s1=int(s[0]+s[1]) int(s[0]+s[1]) s1
s=input()
s1=int(s[0]+s[1])
s2=int(s[2]+s[3])
if (0<s1<13)and(0<s2<13):
    print("AMBIGUOUS")
elif (0<s1<13):
    print("MMYY")
elif (0<s2<13):
    print("YYMM")
else:
    print("NA")