S = input()
month_list = ["01","02","03","04","04","05","06","07","08","09","10","11","12"]

if S[0:2] in month_list:
    if S[2:4] in month_list:
        print("AMBIGUOUS")
    else:
        print("MMYY")

else:
    if S[2:4] in month_list:
        print("YYMM")
    else:
        print("NA") S = input() S input() input month_list = ["01","02","03","04","04","05","06","07","08","09","10","11","12"] month_list ["01","02","03","04","04","05","06","07","08","09","10","11","12"] "01" "02" "03" "04" "04" "05" "06" "07" "08" "09" "10" "11" "12" if S[0:2] in month_list:
    if S[2:4] in month_list:
        print("AMBIGUOUS")
    else:
        print("MMYY")

else:
    if S[2:4] in month_list:
        print("YYMM")
    else:
        print("NA") S[0:2] in month_list S[0:2] S 0:2 0 2 month_list if S[2:4] in month_list:
        print("AMBIGUOUS")
    else:
        print("MMYY") S[2:4] in month_list S[2:4] S 2:4 2 4 month_list print("AMBIGUOUS") print "AMBIGUOUS" print("MMYY") print "MMYY" if S[2:4] in month_list:
        print("YYMM")
    else:
        print("NA") S[2:4] in month_list S[2:4] S 2:4 2 4 month_list print("YYMM") print "YYMM" print("NA") print "NA" month_list = ["01","02","03","04","04","05","06","07","08","09","10","11","12"] ["01","02","03","04","04","05","06","07","08","09","10","11","12"] month_list S = input() input() S
S = input()
month_list = ["01","02","03","04","04","05","06","07","08","09","10","11","12"]

if S[0:2] in month_list:
    if S[2:4] in month_list:
        print("AMBIGUOUS")
    else:
        print("MMYY")

else:
    if S[2:4] in month_list:
        print("YYMM")
    else:
        print("NA")