let is_month n = 0 < n && n <= 12;;

let () = Scanf.scanf "%2d%2d" (fun s t -> 
  (if (is_month s) && (is_month t) then "AMBIGUOUS"
  else if (is_month s) && (not (is_month t)) then "MMYY"
  else if (not (is_month s)) && (is_month t) then "YYMM"
  else "NA") |> print_string
);;