import re
s = input()
f = s[:2]
b = s[2:]
flg_fm = False
flg_bm = False

if f[0] == '0' and bool(re.search('[1-9]', f[1])) or f[0] == '1' and bool(re.search('[0-2]', f[1])):
    flg_fm = True
if b[0] == '0' and bool(re.search('[1-9]', b[1])) or b[0] == '1' and bool(re.search('[0-2]', b[1])):
    flg_bm = True

if flg_fm and flg_bm:
    print('AMBIGUOUS')
elif flg_bm:
    print('YYMM')
elif flg_fm:
    print('MMYY')
else:
    print('NA') import re re s = input() s input() input f = s[:2] f s[:2] s :2 2 b = s[2:] b s[2:] s 2: 2 flg_fm = False flg_fm False flg_bm = False flg_bm False if f[0] == '0' and bool(re.search('[1-9]', f[1])) or f[0] == '1' and bool(re.search('[0-2]', f[1])):
    flg_fm = True f[0] == '0' and bool(re.search('[1-9]', f[1])) or f[0] == '1' and bool(re.search('[0-2]', f[1])) f[0] == '0' and bool(re.search('[1-9]', f[1])) f[0] == '0' f[0] f 0 '0' bool(re.search('[1-9]', f[1])) bool re.search('[1-9]', f[1]) re.search re search '[1-9]' f[1] f 1 f[0] == '1' and bool(re.search('[0-2]', f[1])) f[0] == '1' f[0] f 0 '1' bool(re.search('[0-2]', f[1])) bool re.search('[0-2]', f[1]) re.search re search '[0-2]' f[1] f 1 flg_fm = True flg_fm True if b[0] == '0' and bool(re.search('[1-9]', b[1])) or b[0] == '1' and bool(re.search('[0-2]', b[1])):
    flg_bm = True b[0] == '0' and bool(re.search('[1-9]', b[1])) or b[0] == '1' and bool(re.search('[0-2]', b[1])) b[0] == '0' and bool(re.search('[1-9]', b[1])) b[0] == '0' b[0] b 0 '0' bool(re.search('[1-9]', b[1])) bool re.search('[1-9]', b[1]) re.search re search '[1-9]' b[1] b 1 b[0] == '1' and bool(re.search('[0-2]', b[1])) b[0] == '1' b[0] b 0 '1' bool(re.search('[0-2]', b[1])) bool re.search('[0-2]', b[1]) re.search re search '[0-2]' b[1] b 1 flg_bm = True flg_bm True if flg_fm and flg_bm:
    print('AMBIGUOUS')
elif flg_bm:
    print('YYMM')
elif flg_fm:
    print('MMYY')
else:
    print('NA') flg_fm and flg_bm flg_fm flg_bm print('AMBIGUOUS') print 'AMBIGUOUS' elif flg_bm:
    print('YYMM') flg_bm print('YYMM') print 'YYMM' elif flg_fm:
    print('MMYY') flg_fm print('MMYY') print 'MMYY' print('NA') print 'NA' flg_bm = True True flg_bm f = s[:2] s[:2] f flg_bm = False False flg_bm flg_fm = True True flg_fm s = input() input() s b = s[2:] s[2:] b flg_fm = False False flg_fm
import re
s = input()
f = s[:2]
b = s[2:]
flg_fm = False
flg_bm = False

if f[0] == '0' and bool(re.search('[1-9]', f[1])) or f[0] == '1' and bool(re.search('[0-2]', f[1])):
    flg_fm = True
if b[0] == '0' and bool(re.search('[1-9]', b[1])) or b[0] == '1' and bool(re.search('[0-2]', b[1])):
    flg_bm = True

if flg_fm and flg_bm:
    print('AMBIGUOUS')
elif flg_bm:
    print('YYMM')
elif flg_fm:
    print('MMYY')
else:
    print('NA')