output_description: Print the specified string: `YYMM`, `MMYY`, `AMBIGUOUS` or `NA`.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      S
attempt: import sys
  
  sys.setrecursionlimit(10**9)
  input = sys.stdin.readline
  input_int = lambda: int(input())
  input_ints = lambda: map(int, input().split())
  input_ints_list = lambda: list(input_ints())
  input_str = lambda: input()
  input_strs = lambda: input().split()
  input_lines = lambda n, input_func: [input_func() for _ in range(n)]
  
  import importlib
  
  import_module = lambda module_name: importlib.import_module(module_name)
  
  init_array_1dim = lambda value, n: [value] * n  # 1次元配列を生成
  init_array_2dim = lambda value, n, m: [
      init_array_1dim(value, n) for _ in range(m)
  ]  # 2次元配列を生成
  
  gcd_base = lambda value1, value2: import_module("fractions").gcd(
      value1, value2
  )  # 最大公約数（2値)
  gcd = lambda lst: import_module("functools").reduce(
      gcd_base, lst
  )  # 最大公約数（リスト）
  lcm_base = lambda value1, value2: (value1 * value2) // gcd_base(
      value1, value2
  )  # 最小公倍数(2値)
  lcm = lambda lst: import_module("functools").reduce(
      lcm_base, lst, 1
  )  # 最小公倍数(リスト)
  
  permutations = lambda lst, n: import_module("itertools").permutations(lst, n)  # 順列
  combinations = lambda lst, n: import_module("itertools").combinations(
      lst, n
  )  # 組み合わせ
  product = lambda lst1, lst2: import_module("itertools").product(
      lst1, lst2
  )  # 二つのリストの直積
  
  round = lambda value: round(value)  # 四捨五入
  ceil = lambda value: import_module("math").ceil(value)  # 切り上げ
  floor = lambda value: import_module("math").floor(value)  # 切り捨て
  
  # キュー
  init_q = lambda lst: import_module("collections").deque(lst)
  q_pop = lambda q: q.popleft()  # 先頭から取り出し
  q_push = lambda q, value: q.appendleft(value)  # 先頭に追加（値）
  q_pushlist = lambda q, lst: q.extendleft(lst)  # 先頭に追加（リスト）
  q_append = lambda q, value: q.append(value)  # 末尾に追加（値）
  q_appendlist = lambda q, lst: q.extend(lst)  # 末尾に追加（リスト）
  
  # プライオリティキュー
  init_heap = lambda a: import_module("heapq").heapify(a)
  heap_push = lambda a, v: import_module("heapq").heappush(a, v)
  heap_pop = lambda a: import_module("heapq").heappop(a)  # 最小値を取り出す
  
  
  def solution():
      # ここに実装
      S = input_str()
  
      month_1 = False
      year_1 = False
      if "01" <= S[:2] <= "12":
          month_1 = True
      if "01" <= S[:2] <= "19":
          year_1 = True
      month_2 = False
      year_2 = False
      if "01" <= S[2:] <= "12":
          month_2 = True
      if "01" <= S[2:] <= "19":
          year_2 = True
  
      if month_1 and month_2:
          print("AMBIGUOUS")
          return
      if month_1 and year_2:
          print("MMYY")
          return
      if month_2 and year_1:
          print("YYMM")
          return
      print("NA")
  
  
  if __name__ == "__main__":
      solution()
  
problem_description: Statement
  
  You have a digit sequence S of length 4. You are wondering which of the
  following formats S is in:
  
    * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order
    * MMYY format: the two-digit representation of the month and the last two digits of the year, concatenated in this order
  
  If S is valid in only YYMM format, print `YYMM`; if S is valid in only MMYY
  format, print `MMYY`; if S is valid in both formats, print `AMBIGUOUS`; if S
  is valid in neither format, print `NA`.
samples: [{"input": "1905", "output": "YYMM\n    \n\nMay XX19 is a valid date, but 19 is not valid as a month. Thus, this string is\nonly valid in YYMM format.\n\n* * *"}, {"input": "0112", "output": "AMBIGUOUS\n    \n\nBoth December XX01 and January XX12 are valid dates. Thus, this string is\nvalid in both formats.\n\n* * *"}, {"input": "1700", "output": "NA\n    \n\nNeither 0 nor 17 is valid as a month. Thus, this string is valid in neither\nformat."}]