s = int(input())

a = s % 100
b = (s-a) / 100

if a >= 1 and a <= 12:
    if b >= 1 and b <= 12:
        print('AMBIGUOUS')
    else:
        print('YYMM')
else:
    if b >= 1 and b <= 12:
        print('MMYY')
    else:
        print('NA') s = int(input()) s int(input()) int input() input a = s % 100 a s % 100 s 100 b = (s-a) / 100 b (s-a) / 100 s-a s a 100 if a >= 1 and a <= 12:
    if b >= 1 and b <= 12:
        print('AMBIGUOUS')
    else:
        print('YYMM')
else:
    if b >= 1 and b <= 12:
        print('MMYY')
    else:
        print('NA') a >= 1 and a <= 12 a >= 1 a 1 a <= 12 a 12 if b >= 1 and b <= 12:
        print('AMBIGUOUS')
    else:
        print('YYMM') b >= 1 and b <= 12 b >= 1 b 1 b <= 12 b 12 print('AMBIGUOUS') print 'AMBIGUOUS' print('YYMM') print 'YYMM' if b >= 1 and b <= 12:
        print('MMYY')
    else:
        print('NA') b >= 1 and b <= 12 b >= 1 b 1 b <= 12 b 12 print('MMYY') print 'MMYY' print('NA') print 'NA' s = int(input()) int(input()) s a = s % 100 s % 100 a b = (s-a) / 100 (s-a) / 100 b
s = int(input())

a = s % 100
b = (s-a) / 100

if a >= 1 and a <= 12:
    if b >= 1 and b <= 12:
        print('AMBIGUOUS')
    else:
        print('YYMM')
else:
    if b >= 1 and b <= 12:
        print('MMYY')
    else:
        print('NA')