s = input()
a, b = int(s[:2]), int(s[2:])

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

if 1<=a<=12 and 1<=b<=12:
  print('AMBIGUOUS')
elif 1<=b<=12:
  print('YYMM')
elif 1<=a<=12:
  print('MMYY')
else:
  print('NA')