#include <stdio.h>

int main(void)
{
	int n, m;
	int in[1000][100];
	int countF[100], countS[100];
	int ans[100];
	int i, j;
	
	while (1){
		scanf("%d %d", &n, &m);
		
		if (n == 0 && m == 0)break;
		
		for (i = 0; i < 100; i++){
				for (j = 0; j < 1000; j++){
				in[i][j] = 0;
			}
			
			countF[i] = 0;
			countS[i] = 0;
			ans[i] = 0;
		}
		
		for (i = 0; i < n; i++){
			for (j = 0; j < m; j++){
				scanf("%d", &in[i][j]);
				
				if (in[i][j] == 1){
					countF[j]++;
					countS[j]++;
				}
			}
		}
		
		for (i = 0; i < m - 1; i++){
			for (j = 0; j < m - i - 1; j++){
				if (countS[j] < countS[j + 1]){
					countS[j] += countS[j + 1];
					countS[j + 1] = countS[j] - countS[j + 1];
					countS[j] -= countS[j + 1];
				}
			}
		}
		
		for (i = 0; i < m; i++){
			for (j = 0; j < m; j++){
				if (countS[i] == countF[j]){
					ans[j] = i + 1;
					countF[j] = -1;
						break;
				}
			}
		}
		
		for (i = 0; i < m; i++){
			printf("%d", ans[i]);
			if (i < m - 1){
				printf("\n");
			}
		}
		printf("\n");
	}
	
	return (0);
}