YYMM = False
MMYY = False
f = input()
h1 = f[0] + f[1]
h2 = f[2] + f[3]

if 1 <= int(h2) <= 12:
  YYMM = True
if 1 <= int(h1) <= 12:
  MMYY = True

def ret(c1,c2):
  if c1 and c2:
    return "AMBIGUOUS"
  elif c1:
    return "YYMM"
  elif c2:
    return "MMYY"
  else:
    return "NA"
  
print(ret(YYMM,MMYY)) YYMM = False YYMM False MMYY = False MMYY False f = input() f input() input h1 = f[0] + f[1] h1 f[0] + f[1] f[0] f 0 f[1] f 1 h2 = f[2] + f[3] h2 f[2] + f[3] f[2] f 2 f[3] f 3 if 1 <= int(h2) <= 12:
  YYMM = True 1 <= int(h2) <= 12 1 <= int(h2) 1 int(h2) int h2 12 YYMM = True YYMM True if 1 <= int(h1) <= 12:
  MMYY = True 1 <= int(h1) <= 12 1 <= int(h1) 1 int(h1) int h1 12 MMYY = True MMYY True def ret(c1,c2):
  if c1 and c2:
    return "AMBIGUOUS"
  elif c1:
    return "YYMM"
  elif c2:
    return "MMYY"
  else:
    return "NA"
   ret if c1 and c2:
    return "AMBIGUOUS"
  elif c1:
    return "YYMM"
  elif c2:
    return "MMYY"
  else:
    return "NA"
   c1 and c2 c1 c2 return "AMBIGUOUS" "AMBIGUOUS" elif c1:
    return "YYMM"
   c1 return "YYMM" "YYMM" elif c2:
    return "MMYY"
   c2 return "MMYY" "MMYY" return "NA" "NA" c1 c1 c2 c2 print(ret(YYMM,MMYY)) print ret(YYMM,MMYY) ret YYMM MMYY h1 = f[0] + f[1] f[0] + f[1] h1 YYMM = False False YYMM MMYY = False False MMYY h2 = f[2] + f[3] f[2] + f[3] h2 f = input() input() f def ret(c1,c2):
  if c1 and c2:
    return "AMBIGUOUS"
  elif c1:
    return "YYMM"
  elif c2:
    return "MMYY"
  else:
    return "NA"
   def ret(c1,c2):
  if c1 and c2:
    return "AMBIGUOUS"
  elif c1:
    return "YYMM"
  elif c2:
    return "MMYY"
  else:
    return "NA"
   ret YYMM = True True YYMM MMYY = True True MMYY
YYMM = False
MMYY = False
f = input()
h1 = f[0] + f[1]
h2 = f[2] + f[3]

if 1 <= int(h2) <= 12:
  YYMM = True
if 1 <= int(h1) <= 12:
  MMYY = True

def ret(c1,c2):
  if c1 and c2:
    return "AMBIGUOUS"
  elif c1:
    return "YYMM"
  elif c2:
    return "MMYY"
  else:
    return "NA"
  
print(ret(YYMM,MMYY))