S = list(input())

a = int("".join(S[0:2]))
b = int("".join(S[2:4]))

if 1 <= a <= 12 and 1 <= b <= 12:
    print("AMBIGUOUS")
elif 1 <= a <= 12:
    print("MMYY")
elif 1 <= b <= 12:
    print("YYMM")
else:
    print("NA") S = list(input()) S list(input()) list input() input a = int("".join(S[0:2])) a int("".join(S[0:2])) int "".join(S[0:2]) "".join "" join S[0:2] S 0:2 0 2 b = int("".join(S[2:4])) b int("".join(S[2:4])) int "".join(S[2:4]) "".join "" join S[2:4] S 2:4 2 4 if 1 <= a <= 12 and 1 <= b <= 12:
    print("AMBIGUOUS")
elif 1 <= a <= 12:
    print("MMYY")
elif 1 <= b <= 12:
    print("YYMM")
else:
    print("NA") 1 <= a <= 12 and 1 <= b <= 12 1 <= a <= 12 1 <= a 1 a 12 1 <= b <= 12 1 <= b 1 b 12 print("AMBIGUOUS") print "AMBIGUOUS" elif 1 <= a <= 12:
    print("MMYY") 1 <= a <= 12 1 <= a 1 a 12 print("MMYY") print "MMYY" elif 1 <= b <= 12:
    print("YYMM") 1 <= b <= 12 1 <= b 1 b 12 print("YYMM") print "YYMM" print("NA") print "NA" S = list(input()) list(input()) S a = int("".join(S[0:2])) int("".join(S[0:2])) a b = int("".join(S[2:4])) int("".join(S[2:4])) b
S = list(input())

a = int("".join(S[0:2]))
b = int("".join(S[2:4]))

if 1 <= a <= 12 and 1 <= b <= 12:
    print("AMBIGUOUS")
elif 1 <= a <= 12:
    print("MMYY")
elif 1 <= b <= 12:
    print("YYMM")
else:
    print("NA")
