### main

loop do
  n, m = gets.strip.split(' ').map{|s| s.to_i}
  break if (n | m) == 0

  msums = m.times.map{0}

  n.times do
    as = gets.strip.split(' ').map{|s| s.to_i}
    for i in (0...m)
      msums[i] += as[i]
    end
  end
  #p msums

  mps = (1..m).zip(msums)
  mps.sort!{|a, b| (cmp = b[1] <=> a[1]) != 0 ? cmp : a[0] <=> b[0]}

  puts mps.map{|mp| mp[0]}.join(' ')
end