while true
    n, m = gets.chomp.split.map(&:to_i)
    break if [n, m] == [0, 0]
    h = Hash.new(0)
    n.times{gets.chomp.split.map(&:to_i).each_with_index{|x, i| h[i + 1] += x}}
    puts h.to_a.sort_by{|a, b| [-b, a]}.map{|a, b| a}.join(" ")
end

