S = input()

if int(S[0:2]) > 12 or S[0:2] == "00":
    if 0 < int(S[2:4]) <= 12:
        print("YYMM")
    else:
        print("NA")
else:
    if 0 < int(S[2:4]) <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY") S = input() S input() input if int(S[0:2]) > 12 or S[0:2] == "00":
    if 0 < int(S[2:4]) <= 12:
        print("YYMM")
    else:
        print("NA")
else:
    if 0 < int(S[2:4]) <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY") int(S[0:2]) > 12 or S[0:2] == "00" int(S[0:2]) > 12 int(S[0:2]) int S[0:2] S 0:2 0 2 12 S[0:2] == "00" S[0:2] S 0:2 0 2 "00" if 0 < int(S[2:4]) <= 12:
        print("YYMM")
    else:
        print("NA") 0 < int(S[2:4]) <= 12 0 < int(S[2:4]) 0 int(S[2:4]) int S[2:4] S 2:4 2 4 12 print("YYMM") print "YYMM" print("NA") print "NA" if 0 < int(S[2:4]) <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY") 0 < int(S[2:4]) <= 12 0 < int(S[2:4]) 0 int(S[2:4]) int S[2:4] S 2:4 2 4 12 print("AMBIGUOUS") print "AMBIGUOUS" print("MMYY") print "MMYY" S = input() input() S
S = input()

if int(S[0:2]) > 12 or S[0:2] == "00":
    if 0 < int(S[2:4]) <= 12:
        print("YYMM")
    else:
        print("NA")
else:
    if 0 < int(S[2:4]) <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")