from sys import exit
S = input()

if 0 < int(S[0:2]) < 13:
    if 0 < int(S[2:]) < 13:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 0 < int(S[2:]) < 13:
        print("YYMM")
    else:
        print("NA") from sys import exit S = input() S input() input if 0 < int(S[0:2]) < 13:
    if 0 < int(S[2:]) < 13:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 0 < int(S[2:]) < 13:
        print("YYMM")
    else:
        print("NA") 0 < int(S[0:2]) < 13 0 < int(S[0:2]) 0 int(S[0:2]) int S[0:2] S 0:2 0 2 13 if 0 < int(S[2:]) < 13:
        print("AMBIGUOUS")
    else:
        print("MMYY") 0 < int(S[2:]) < 13 0 < int(S[2:]) 0 int(S[2:]) int S[2:] S 2: 2 13 print("AMBIGUOUS") print "AMBIGUOUS" print("MMYY") print "MMYY" if 0 < int(S[2:]) < 13:
        print("YYMM")
    else:
        print("NA") 0 < int(S[2:]) < 13 0 < int(S[2:]) 0 int(S[2:]) int S[2:] S 2: 2 13 print("YYMM") print "YYMM" print("NA") print "NA" S = input() input() S
from sys import exit
S = input()

if 0 < int(S[0:2]) < 13:
    if 0 < int(S[2:]) < 13:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 0 < int(S[2:]) < 13:
        print("YYMM")
    else:
        print("NA")