while str = gets do
    num1, num2 = str.chomp.split(" ").map(&:to_i)
    return if num1 == 0 && num2 == 0
    sum_array = []
    num2.times do |n|
        sum_array << [0, n + 1]
    end
    
    num1.times do |n|
        array = gets.chomp.split(" ").map(&:to_i)
        array.each_with_index do |m, i|
            sum_array[i][0] += m
        end
    end
    puts sum_array.sort_by!{|ar| ar[0]}.map(&:last).join(" ")
end