S = input()
high = int(S[0:2])
low = int(S[2:4])

if 1<= high <= 12:
    if 1<= low <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
if high < 1 or high > 12:
    if 1<= low <= 12:
        print("YYMM")
    else:
        print("NA")
 S = input() S input() input high = int(S[0:2]) high int(S[0:2]) int S[0:2] S 0:2 0 2 low = int(S[2:4]) low int(S[2:4]) int S[2:4] S 2:4 2 4 if 1<= high <= 12:
    if 1<= low <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY") 1<= high <= 12 1<= high 1 high 12 if 1<= low <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY") 1<= low <= 12 1<= low 1 low 12 print("AMBIGUOUS") print "AMBIGUOUS" print("MMYY") print "MMYY" if high < 1 or high > 12:
    if 1<= low <= 12:
        print("YYMM")
    else:
        print("NA") high < 1 or high > 12 high < 1 high 1 high > 12 high 12 if 1<= low <= 12:
        print("YYMM")
    else:
        print("NA") 1<= low <= 12 1<= low 1 low 12 print("YYMM") print "YYMM" print("NA") print "NA" S = input() input() S low = int(S[2:4]) int(S[2:4]) low high = int(S[0:2]) int(S[0:2]) high
S = input()
high = int(S[0:2])
low = int(S[2:4])

if 1<= high <= 12:
    if 1<= low <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
if high < 1 or high > 12:
    if 1<= low <= 12:
        print("YYMM")
    else:
        print("NA")

