Scanf.scanf "%s" @@ fun s ->
  let n1 = String.sub s 0 2 |> int_of_string in
  let n2 = String.sub s 2 2 |> int_of_string in
  print_endline @@ if n1 > 12 || n1 = 0 then
      if n2 > 12 || n2 = 0 then
        "NA"
      else
        "YYMM"
    else
      if n2 > 12 || n2 = 0 then
        "MMYY"
      else
        "AMBIGUOUS"