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