process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk) {
    main(chunk.trim());
});

function main(chunk){
    var lines = chunk.split("\n");
    for(var i=0;i<lines.length;){
        var line = lines[i++];
        var n = Number(line.split(" ")[0]);
        var m = Number(line.split(" ")[1]);
        if(n==0&&m==0) break;

        var arr = new Array(m);
        for(var j=0;j<m;j++){
            arr[j] = {idx:1+j,sum:0};
        }
        for(var j=0;j<n;j++){
            line = lines[i++];
            for(var k=0;k<m;k++){
                var a = line.split(" ")[k];
                if(a==1){
                    arr[k].sum += 1;
                }
            }
        }
        arr.sort(function(a,b){
            return (a.sum-b.sum!=0)?(b.sum-a.sum):(a.idx-b.idx);
        });
        var ans = "";
        for(var j=0;j<m;j++){
            ans += arr[j].idx + " ";
        }
        console.log(ans.trim());
    }
}