let read_lines n =
  let rec read_lines n acc =
    if n = 0 then List.rev acc
    else read_lines (pred n) ((read_line ()) :: acc) in
  read_lines n []

let split str delim =
  let len = String.length str in
  let rec split offset acc =
    try
      let index = String.index_from str offset delim in
      split (index + 1) ((String.sub str offset (index - offset)) :: acc)
    with Not_found ->
      List.rev ((String.sub str offset (len - offset)) :: acc) in
  split 0 []

let rec solve () =
  let line = read_line () in
  let n, m = Scanf.sscanf line "%d %d" (fun n m -> n, m) in
  if n = 0 && m = 0 then ()
  else
    let rec zero_list n acc =
      if n = 0 then acc
      else zero_list (n - 1) (0 :: acc) in
    let zero_list = zero_list m [] in
    let votes = List.map
                  (fun line -> List.map int_of_string @@ split line ' ')
                  (read_lines n) in
    let votes = List.fold_left
                  (fun acc vote -> List.map2 ( + ) acc vote)
                  zero_list
                  votes in
    let places = List.map fst
                 @@ List.sort (fun (p1, v1) (p2, v2) ->
                               let c = compare v2 v1 in
                               if c <> 0 then c
                               else compare p1 p2)
                 @@ List.mapi (fun i v -> (i + 1, v)) votes in
    print_endline @@ String.concat " " @@ List.map string_of_int places;
    solve ()

let () = solve ()