
require 'pp'

def gets_nums
  $stdin.gets.chomp.split(" ").map(&:to_i)
end

class Array
  def sum
    self.inject(0) {|x, accum| x + accum}
  end
end

loop do
  n, m = gets_nums
  break if (n == 0 && m == 0)
  table = n.times.map {gets_nums}.transpose.each_with_index.map {|line, i|
    {:i => i + 1, :line => line}
  }
  puts table.sort_by {|item| item[:line].sum}.reverse.map {|item| item[:i]}.join(" ")
end