s = input()
a1 = int(s[:2])
a2 = int(s[2:])
if a1 in range(1, 13):
  if a2 in range(1, 13): print("AMBIGUOUS")
  else: print("MMYY")
else:
  if a2 in range(1, 13): print("YYMM")
  else: print("NA") s = input() s input() input a1 = int(s[:2]) a1 int(s[:2]) int s[:2] s :2 2 a2 = int(s[2:]) a2 int(s[2:]) int s[2:] s 2: 2 if a1 in range(1, 13):
  if a2 in range(1, 13): print("AMBIGUOUS")
  else: print("MMYY")
else:
  if a2 in range(1, 13): print("YYMM")
  else: print("NA") a1 in range(1, 13) a1 range(1, 13) range 1 13 if a2 in range(1, 13): print("AMBIGUOUS")
  else: print("MMYY") a2 in range(1, 13) a2 range(1, 13) range 1 13 if a2 in range(1, 13): print("YYMM")
  else: print("NA") a2 in range(1, 13) a2 range(1, 13) range 1 13 s = input() input() s a2 = int(s[2:]) int(s[2:]) a2 a1 = int(s[:2]) int(s[:2]) a1
s = input()
a1 = int(s[:2])
a2 = int(s[2:])
if a1 in range(1, 13):
  if a2 in range(1, 13): print("AMBIGUOUS")
  else: print("MMYY")
else:
  if a2 in range(1, 13): print("YYMM")
  else: print("NA")