s=int(input())
s1=s//100
s2=s-s1*100
if 0<s1<=12 and 0<s2<=12:
    print("AMBIGUOUS")
elif (s1>12 or s1==0) and 0<s2<=12:
    print("YYMM")
elif 0<s1<=12 and (s2>12 or s2==0):
    print("MMYY")
else:
    print("NA") s=int(input()) s int(input()) int input() input s1=s//100 s1 s//100 s 100 s2=s-s1*100 s2 s-s1*100 s s1*100 s1 100 if 0<s1<=12 and 0<s2<=12:
    print("AMBIGUOUS")
elif (s1>12 or s1==0) and 0<s2<=12:
    print("YYMM")
elif 0<s1<=12 and (s2>12 or s2==0):
    print("MMYY")
else:
    print("NA") 0<s1<=12 and 0<s2<=12 0<s1<=12 0<s1 0 s1 12 0<s2<=12 0<s2 0 s2 12 print("AMBIGUOUS") print "AMBIGUOUS" elif (s1>12 or s1==0) and 0<s2<=12:
    print("YYMM") (s1>12 or s1==0) and 0<s2<=12 s1>12 or s1==0 s1>12 s1 12 s1==0 s1 0 0<s2<=12 0<s2 0 s2 12 print("YYMM") print "YYMM" elif 0<s1<=12 and (s2>12 or s2==0):
    print("MMYY") 0<s1<=12 and (s2>12 or s2==0) 0<s1<=12 0<s1 0 s1 12 s2>12 or s2==0 s2>12 s2 12 s2==0 s2 0 print("MMYY") print "MMYY" print("NA") print "NA" s=int(input()) int(input()) s s2=s-s1*100 s-s1*100 s2 s1=s//100 s//100 s1
s=int(input())
s1=s//100
s2=s-s1*100
if 0<s1<=12 and 0<s2<=12:
    print("AMBIGUOUS")
elif (s1>12 or s1==0) and 0<s2<=12:
    print("YYMM")
elif 0<s1<=12 and (s2>12 or s2==0):
    print("MMYY")
else:
    print("NA")