S = input()
a,b = int(S[:2]),int(S[2:])
if (1<=a and a<=12) or (1<=b and b<=12):
    if (1<=a and a<=12) and (1<=b and b<=12): 
        print("AMBIGUOUS")
    elif (1<=b and b<=12):
        print("YYMM")
    elif  (1<=a and a<=12): 
        print("MMYY")
  
else:
    print("NA")



 S = input() S input() input a,b = int(S[:2]),int(S[2:]) a int(S[:2]) int S[:2] S :2 2 b int(S[2:]) int S[2:] S 2: 2 if (1<=a and a<=12) or (1<=b and b<=12):
    if (1<=a and a<=12) and (1<=b and b<=12): 
        print("AMBIGUOUS")
    elif (1<=b and b<=12):
        print("YYMM")
    elif  (1<=a and a<=12): 
        print("MMYY")
  
else:
    print("NA") (1<=a and a<=12) or (1<=b and b<=12) 1<=a and a<=12 1<=a 1 a a<=12 a 12 1<=b and b<=12 1<=b 1 b b<=12 b 12 if (1<=a and a<=12) and (1<=b and b<=12): 
        print("AMBIGUOUS")
    elif (1<=b and b<=12):
        print("YYMM")
    elif  (1<=a and a<=12): 
        print("MMYY")
   (1<=a and a<=12) and (1<=b and b<=12) 1<=a and a<=12 1<=a 1 a a<=12 a 12 1<=b and b<=12 1<=b 1 b b<=12 b 12 print("AMBIGUOUS") print "AMBIGUOUS" elif (1<=b and b<=12):
        print("YYMM")
     1<=b and b<=12 1<=b 1 b b<=12 b 12 print("YYMM") print "YYMM" elif  (1<=a and a<=12): 
        print("MMYY")
   1<=a and a<=12 1<=a 1 a a<=12 a 12 print("MMYY") print "MMYY" print("NA") print "NA" b = int(S[:2]),int(S[2:]) int(S[2:]) b S = input() input() S a,b = int(S[:2]),int(S[2:]) int(S[:2]) a
S = input()
a,b = int(S[:2]),int(S[2:])
if (1<=a and a<=12) or (1<=b and b<=12):
    if (1<=a and a<=12) and (1<=b and b<=12): 
        print("AMBIGUOUS")
    elif (1<=b and b<=12):
        print("YYMM")
    elif  (1<=a and a<=12): 
        print("MMYY")
  
else:
    print("NA")




