s = input()
upper_input = int(s[:2])
lower_input = int(s[2:])

if upper_input >= 1 and upper_input<= 12:
  if lower_input >= 1 and lower_input <= 12:
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if lower_input >= 1 and lower_input <= 12:
    print('YYMM')
  else:
    print('NA') s = input() s input() input upper_input = int(s[:2]) upper_input int(s[:2]) int s[:2] s :2 2 lower_input = int(s[2:]) lower_input int(s[2:]) int s[2:] s 2: 2 if upper_input >= 1 and upper_input<= 12:
  if lower_input >= 1 and lower_input <= 12:
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if lower_input >= 1 and lower_input <= 12:
    print('YYMM')
  else:
    print('NA') upper_input >= 1 and upper_input<= 12 upper_input >= 1 upper_input 1 upper_input<= 12 upper_input 12 if lower_input >= 1 and lower_input <= 12:
    print('AMBIGUOUS')
  else:
    print('MMYY') lower_input >= 1 and lower_input <= 12 lower_input >= 1 lower_input 1 lower_input <= 12 lower_input 12 print('AMBIGUOUS') print 'AMBIGUOUS' print('MMYY') print 'MMYY' if lower_input >= 1 and lower_input <= 12:
    print('YYMM')
  else:
    print('NA') lower_input >= 1 and lower_input <= 12 lower_input >= 1 lower_input 1 lower_input <= 12 lower_input 12 print('YYMM') print 'YYMM' print('NA') print 'NA' s = input() input() s lower_input = int(s[2:]) int(s[2:]) lower_input upper_input = int(s[:2]) int(s[:2]) upper_input
s = input()
upper_input = int(s[:2])
lower_input = int(s[2:])

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