S = input()
A = int(S[0] + S[1])
B = int(S[2] + S[3])

if 1 <= A <= 12 and 1 <= B <= 12:
    print('AMBIGUOUS')
elif (A > 12 or A <= 0) and 1 <= B <= 12:
    print('YYMM')
elif 1 <= A <= 12 and (B > 12 or B <= 0):
    print('MMYY')
else:
    print('NA') S = input() S input() input A = int(S[0] + S[1]) A int(S[0] + S[1]) int S[0] + S[1] S[0] S 0 S[1] S 1 B = int(S[2] + S[3]) B int(S[2] + S[3]) int S[2] + S[3] S[2] S 2 S[3] S 3 if 1 <= A <= 12 and 1 <= B <= 12:
    print('AMBIGUOUS')
elif (A > 12 or A <= 0) and 1 <= B <= 12:
    print('YYMM')
elif 1 <= A <= 12 and (B > 12 or B <= 0):
    print('MMYY')
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 (A > 12 or A <= 0) and 1 <= B <= 12:
    print('YYMM') (A > 12 or A <= 0) and 1 <= B <= 12 A > 12 or A <= 0 A > 12 A 12 A <= 0 A 0 1 <= B <= 12 1 <= B 1 B 12 print('YYMM') print 'YYMM' elif 1 <= A <= 12 and (B > 12 or B <= 0):
    print('MMYY') 1 <= A <= 12 and (B > 12 or B <= 0) 1 <= A <= 12 1 <= A 1 A 12 B > 12 or B <= 0 B > 12 B 12 B <= 0 B 0 print('MMYY') print 'MMYY' print('NA') print 'NA' B = int(S[2] + S[3]) int(S[2] + S[3]) B A = int(S[0] + S[1]) int(S[0] + S[1]) A S = input() input() S
S = input()
A = int(S[0] + S[1])
B = int(S[2] + S[3])

if 1 <= A <= 12 and 1 <= B <= 12:
    print('AMBIGUOUS')
elif (A > 12 or A <= 0) and 1 <= B <= 12:
    print('YYMM')
elif 1 <= A <= 12 and (B > 12 or B <= 0):
    print('MMYY')
else:
    print('NA')
