S = int(input())
A = S//100
B = S%100
if 0 < A <= 12 and 0 < B <= 12:
    print("AMBIGUOUS")
elif 0 < A <= 12:
    print("MMYY")
elif 0 < B <= 12:
    print("YYMM")
else:
    print("NA") S = int(input()) S int(input()) int input() input A = S//100 A S//100 S 100 B = S%100 B S%100 S 100 if 0 < A <= 12 and 0 < B <= 12:
    print("AMBIGUOUS")
elif 0 < A <= 12:
    print("MMYY")
elif 0 < B <= 12:
    print("YYMM")
else:
    print("NA") 0 < A <= 12 and 0 < B <= 12 0 < A <= 12 0 < A 0 A 12 0 < B <= 12 0 < B 0 B 12 print("AMBIGUOUS") print "AMBIGUOUS" elif 0 < A <= 12:
    print("MMYY") 0 < A <= 12 0 < A 0 A 12 print("MMYY") print "MMYY" elif 0 < B <= 12:
    print("YYMM") 0 < B <= 12 0 < B 0 B 12 print("YYMM") print "YYMM" print("NA") print "NA" B = S%100 S%100 B S = int(input()) int(input()) S A = S//100 S//100 A
S = int(input())
A = S//100
B = S%100
if 0 < A <= 12 and 0 < B <= 12:
    print("AMBIGUOUS")
elif 0 < A <= 12:
    print("MMYY")
elif 0 < B <= 12:
    print("YYMM")
else:
    print("NA")