s = input()
mmyy = (1 <= int(s[:2]) <= 12)
yymm = (1 <= int(s[2:]) <= 12)
if mmyy:
  if yymm:
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if yymm:
    print('YYMM')
  else:
    print('NA') s = input() s input() input 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 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 if mmyy:
  if yymm:
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if yymm:
    print('YYMM')
  else:
    print('NA') mmyy if yymm:
    print('AMBIGUOUS')
  else:
    print('MMYY') yymm print('AMBIGUOUS') print 'AMBIGUOUS' print('MMYY') print 'MMYY' if yymm:
    print('YYMM')
  else:
    print('NA') yymm print('YYMM') print 'YYMM' 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()
mmyy = (1 <= int(s[:2]) <= 12)
yymm = (1 <= int(s[2:]) <= 12)
if mmyy:
  if yymm:
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if yymm:
    print('YYMM')
  else:
    print('NA')