ans = []
while line = $stdin.gets.chomp
	data  = line.split(/ /).map( &:to_i )
	n = data[ 0 ]
	m = data[ 1 ]
	break if n == 0 && m == 0

	sum = Array.new( m, 0 )
	n.times{
		q= $stdin.gets.chomp.split(/ /).map( &:to_i )
		m.times{ |i|
			sum[ i ] += q[ i ]
		}
	}
	data2 = []
	m.times{ |i|
		data2 << [ i + 1, sum[ i ]]
	}
#	p data2
	ans << data2.sort{ |a,b| b[1] <=> a[1] }.map{ |e| e[ 0 ] }
end
ans.each{ |a|
	a.each_with_index{ |n,i|
		print ' ' if i > 0
		print n
	}
	puts
}
