s = input()

ym = 1 <= int(s[2:]) <= 12
my = 1 <= int(s[:2]) <= 12

if ym and my:
    print('AMBIGUOUS')
elif ym:
    print('YYMM')
elif my:
    print('MMYY')
else:
    print('NA') s = input() s input() input ym = 1 <= int(s[2:]) <= 12 ym 1 <= int(s[2:]) <= 12 1 <= int(s[2:]) 1 int(s[2:]) int s[2:] s 2: 2 12 my = 1 <= int(s[:2]) <= 12 my 1 <= int(s[:2]) <= 12 1 <= int(s[:2]) 1 int(s[:2]) int s[:2] s :2 2 12 if ym and my:
    print('AMBIGUOUS')
elif ym:
    print('YYMM')
elif my:
    print('MMYY')
else:
    print('NA') ym and my ym my print('AMBIGUOUS') print 'AMBIGUOUS' elif ym:
    print('YYMM') ym print('YYMM') print 'YYMM' elif my:
    print('MMYY') my print('MMYY') print 'MMYY' print('NA') print 'NA' ym = 1 <= int(s[2:]) <= 12 1 <= int(s[2:]) <= 12 ym s = input() input() s my = 1 <= int(s[:2]) <= 12 1 <= int(s[:2]) <= 12 my
s = input()

ym = 1 <= int(s[2:]) <= 12
my = 1 <= int(s[:2]) <= 12

if ym and my:
    print('AMBIGUOUS')
elif ym:
    print('YYMM')
elif my:
    print('MMYY')
else:
    print('NA')