def m(s):
  return True if 1 <= int(s) <= 12 else False

s = input()
f = int(s[:2])
l = int(s[2:])

if m(f) and m(l):
  print("AMBIGUOUS")
elif m(f):
  print("MMYY")
elif m(l):
  print("YYMM")
else:
  print("NA")
 def m(s):
  return True if 1 <= int(s) <= 12 else False m return True if 1 <= int(s) <= 12 else False True if 1 <= int(s) <= 12 else False 1 <= int(s) <= 12 1 <= int(s) 1 int(s) int s 12 True False s s s = input() s input() input f = int(s[:2]) f int(s[:2]) int s[:2] s :2 2 l = int(s[2:]) l int(s[2:]) int s[2:] s 2: 2 if m(f) and m(l):
  print("AMBIGUOUS")
elif m(f):
  print("MMYY")
elif m(l):
  print("YYMM")
else:
  print("NA") m(f) and m(l) m(f) m f m(l) m l print("AMBIGUOUS") print "AMBIGUOUS" elif m(f):
  print("MMYY") m(f) m f print("MMYY") print "MMYY" elif m(l):
  print("YYMM") m(l) m l print("YYMM") print "YYMM" print("NA") print "NA" l = int(s[2:]) int(s[2:]) l f = int(s[:2]) int(s[:2]) f def m(s):
  return True if 1 <= int(s) <= 12 else False def m(s):
  return True if 1 <= int(s) <= 12 else False m s = input() input() s
def m(s):
  return True if 1 <= int(s) <= 12 else False

s = input()
f = int(s[:2])
l = int(s[2:])

if m(f) and m(l):
  print("AMBIGUOUS")
elif m(f):
  print("MMYY")
elif m(l):
  print("YYMM")
else:
  print("NA")

