S = int(input())
S1, S2 = S // 100, S % 100

YYMM = (1 <= S2 and S2 <= 12)
MMYY = (1 <= S1 and S1 <= 12)

if YYMM and MMYY:
    print("AMBIGUOUS")
elif YYMM:
    print("YYMM")
elif MMYY:
    print("MMYY")
else:
    print("NA") S = int(input()) S int(input()) int input() input S1, S2 = S // 100, S % 100 S1 S // 100 S 100 S2 S % 100 S 100 YYMM = (1 <= S2 and S2 <= 12) YYMM 1 <= S2 and S2 <= 12 1 <= S2 1 S2 S2 <= 12 S2 12 MMYY = (1 <= S1 and S1 <= 12) MMYY 1 <= S1 and S1 <= 12 1 <= S1 1 S1 S1 <= 12 S1 12 if YYMM and MMYY:
    print("AMBIGUOUS")
elif YYMM:
    print("YYMM")
elif MMYY:
    print("MMYY")
else:
    print("NA") YYMM and MMYY YYMM MMYY print("AMBIGUOUS") print "AMBIGUOUS" elif YYMM:
    print("YYMM") YYMM print("YYMM") print "YYMM" elif MMYY:
    print("MMYY") MMYY print("MMYY") print "MMYY" print("NA") print "NA" YYMM = (1 <= S2 and S2 <= 12) 1 <= S2 and S2 <= 12 YYMM S = int(input()) int(input()) S S1, S2 = S // 100, S % 100 S // 100 S1 MMYY = (1 <= S1 and S1 <= 12) 1 <= S1 and S1 <= 12 MMYY S2 = S // 100, S % 100 S % 100 S2
S = int(input())
S1, S2 = S // 100, S % 100

YYMM = (1 <= S2 and S2 <= 12)
MMYY = (1 <= S1 and S1 <= 12)

if YYMM and MMYY:
    print("AMBIGUOUS")
elif YYMM:
    print("YYMM")
elif MMYY:
    print("MMYY")
else:
    print("NA")