S = list(input())
x = int("".join(S[0:2]))
y = int("".join(S[2:4]))
if 1 <= x <= 12:
    if 1 <= y <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1 <= y <= 12:
        print("YYMM")
    else:
        print("NA")
pass S = list(input()) S list(input()) list input() input x = int("".join(S[0:2])) x int("".join(S[0:2])) int "".join(S[0:2]) "".join "" join S[0:2] S 0:2 0 2 y = int("".join(S[2:4])) y int("".join(S[2:4])) int "".join(S[2:4]) "".join "" join S[2:4] S 2:4 2 4 if 1 <= x <= 12:
    if 1 <= y <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1 <= y <= 12:
        print("YYMM")
    else:
        print("NA") 1 <= x <= 12 1 <= x 1 x 12 if 1 <= y <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY") 1 <= y <= 12 1 <= y 1 y 12 print("AMBIGUOUS") print "AMBIGUOUS" print("MMYY") print "MMYY" if 1 <= y <= 12:
        print("YYMM")
    else:
        print("NA") 1 <= y <= 12 1 <= y 1 y 12 print("YYMM") print "YYMM" print("NA") print "NA" S = list(input()) list(input()) S y = int("".join(S[2:4])) int("".join(S[2:4])) y x = int("".join(S[0:2])) int("".join(S[0:2])) x
S = list(input())
x = int("".join(S[0:2]))
y = int("".join(S[2:4]))
if 1 <= x <= 12:
    if 1 <= y <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1 <= y <= 12:
        print("YYMM")
    else:
        print("NA")
pass
