def is_month(x):
  if 1 <= x <= 12:
    return True
  else:
    return False

S = input()
first, latter = is_month(int(S[:2])), is_month(int(S[2:]))
if first and latter:
  ans = "AMBIGUOUS"
elif not first and not latter:
  ans = "NA"
elif first:
  ans = "MMYY"
else:
  ans = "YYMM"
print(ans) def is_month(x):
  if 1 <= x <= 12:
    return True
  else:
    return False is_month if 1 <= x <= 12:
    return True
  else:
    return False 1 <= x <= 12 1 <= x 1 x 12 return True True return False False x x S = input() S input() input first, latter = is_month(int(S[:2])), is_month(int(S[2:])) first is_month(int(S[:2])) is_month int(S[:2]) int S[:2] S :2 2 latter is_month(int(S[2:])) is_month int(S[2:]) int S[2:] S 2: 2 if first and latter:
  ans = "AMBIGUOUS"
elif not first and not latter:
  ans = "NA"
elif first:
  ans = "MMYY"
else:
  ans = "YYMM" first and latter first latter ans = "AMBIGUOUS" ans "AMBIGUOUS" elif not first and not latter:
  ans = "NA" not first and not latter not first first not latter latter ans = "NA" ans "NA" elif first:
  ans = "MMYY" first ans = "MMYY" ans "MMYY" ans = "YYMM" ans "YYMM" print(ans) print ans ans = "YYMM" "YYMM" ans def is_month(x):
  if 1 <= x <= 12:
    return True
  else:
    return False def is_month(x):
  if 1 <= x <= 12:
    return True
  else:
    return False is_month latter = is_month(int(S[:2])), is_month(int(S[2:])) is_month(int(S[2:])) latter ans = "NA" "NA" ans ans = "MMYY" "MMYY" ans first, latter = is_month(int(S[:2])), is_month(int(S[2:])) is_month(int(S[:2])) first S = input() input() S ans = "AMBIGUOUS" "AMBIGUOUS" ans
def is_month(x):
  if 1 <= x <= 12:
    return True
  else:
    return False

S = input()
first, latter = is_month(int(S[:2])), is_month(int(S[2:]))
if first and latter:
  ans = "AMBIGUOUS"
elif not first and not latter:
  ans = "NA"
elif first:
  ans = "MMYY"
else:
  ans = "YYMM"
print(ans)