#include <bits/stdc++.h>

using namespace std;

typedef pair<int, int> pii;

int main()
{
    int N, M;
    while (cin >> N >> M, N) {
        vector<vector<int>> a(N, vector<int>(M));
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < M; j++) {
                cin >> a[i][j];
            }
        }
        priority_queue<pii> Q;
        for (int i = 0; i < M; i++) {
            int cnt = 0;
            for (int j = 0; j < N; j++) {
                if (a[j][i] == 1) ++cnt;
            }
            Q.push(pii(cnt, -(i+1)));
        }
        bool f = 0;
        while (!Q.empty()) {
            if (f) cout << " ";
            f = 1;
            cout << -Q.top().second; Q.pop();
        }
        cout << endl;
    }
    return 0;
}