def main():
  s=input()
  sa=int(s[:2])
  sb=int(s[2:])
  if 1 <= sa and sa <= 12:
    if 1 <= sb and sb <= 12:
      print('AMBIGUOUS')
    else:
      print('MMYY')
  else:
    if 1 <= sb and sb <= 12:
      print('YYMM')
    else:
      print('NA')
main() def main():
  s=input()
  sa=int(s[:2])
  sb=int(s[2:])
  if 1 <= sa and sa <= 12:
    if 1 <= sb and sb <= 12:
      print('AMBIGUOUS')
    else:
      print('MMYY')
  else:
    if 1 <= sb and sb <= 12:
      print('YYMM')
    else:
      print('NA') main s=input() s input() input sa=int(s[:2]) sa int(s[:2]) int s[:2] s :2 2 sb=int(s[2:]) sb int(s[2:]) int s[2:] s 2: 2 if 1 <= sa and sa <= 12:
    if 1 <= sb and sb <= 12:
      print('AMBIGUOUS')
    else:
      print('MMYY')
  else:
    if 1 <= sb and sb <= 12:
      print('YYMM')
    else:
      print('NA') 1 <= sa and sa <= 12 1 <= sa 1 sa sa <= 12 sa 12 if 1 <= sb and sb <= 12:
      print('AMBIGUOUS')
    else:
      print('MMYY')
   1 <= sb and sb <= 12 1 <= sb 1 sb sb <= 12 sb 12 print('AMBIGUOUS') print 'AMBIGUOUS' print('MMYY') print 'MMYY' if 1 <= sb and sb <= 12:
      print('YYMM')
    else:
      print('NA') 1 <= sb and sb <= 12 1 <= sb 1 sb sb <= 12 sb 12 print('YYMM') print 'YYMM' print('NA') print 'NA' main() main def main():
  s=input()
  sa=int(s[:2])
  sb=int(s[2:])
  if 1 <= sa and sa <= 12:
    if 1 <= sb and sb <= 12:
      print('AMBIGUOUS')
    else:
      print('MMYY')
  else:
    if 1 <= sb and sb <= 12:
      print('YYMM')
    else:
      print('NA') def main():
  s=input()
  sa=int(s[:2])
  sb=int(s[2:])
  if 1 <= sa and sa <= 12:
    if 1 <= sb and sb <= 12:
      print('AMBIGUOUS')
    else:
      print('MMYY')
  else:
    if 1 <= sb and sb <= 12:
      print('YYMM')
    else:
      print('NA') main
def main():
  s=input()
  sa=int(s[:2])
  sb=int(s[2:])
  if 1 <= sa and sa <= 12:
    if 1 <= sb and sb <= 12:
      print('AMBIGUOUS')
    else:
      print('MMYY')
  else:
    if 1 <= sb and sb <= 12:
      print('YYMM')
    else:
      print('NA')
main()