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