S = input()
l, r = int(S[:2]), int(S[2:])
if 0<l<13 and 0<r<13:
    print("AMBIGUOUS")
elif 0<l<13:
    print("MMYY")
elif 0<r<13:
    print("YYMM")
else:
    print("NA") S = input() S input() input l, r = int(S[:2]), int(S[2:]) l int(S[:2]) int S[:2] S :2 2 r int(S[2:]) int S[2:] S 2: 2 if 0<l<13 and 0<r<13:
    print("AMBIGUOUS")
elif 0<l<13:
    print("MMYY")
elif 0<r<13:
    print("YYMM")
else:
    print("NA") 0<l<13 and 0<r<13 0<l<13 0<l 0 l 13 0<r<13 0<r 0 r 13 print("AMBIGUOUS") print "AMBIGUOUS" elif 0<l<13:
    print("MMYY") 0<l<13 0<l 0 l 13 print("MMYY") print "MMYY" elif 0<r<13:
    print("YYMM") 0<r<13 0<r 0 r 13 print("YYMM") print "YYMM" print("NA") print "NA" r = int(S[:2]), int(S[2:]) int(S[2:]) r S = input() input() S l, r = int(S[:2]), int(S[2:]) int(S[:2]) l
S = input()
l, r = int(S[:2]), int(S[2:])
if 0<l<13 and 0<r<13:
    print("AMBIGUOUS")
elif 0<l<13:
    print("MMYY")
elif 0<r<13:
    print("YYMM")
else:
    print("NA")
