#include<iostream>
using namespace std;

unsigned long long h, n, i, j, a[10000][10000], b[10000], s;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	cin >> h >> n;
	
	for (i=0; i<h; i++)
	for (j=0; j<n; j++)
		cin >> a[i][j];
		
	s = n;	
	for (i=0; i<n; i++) {
		if (a[h-1][i] == 0) b[i] = 0;
		else {
			b[i] = 1;
			s--;
		}
	}	
	
	if (s!=0) {
		for (i=0; i<n; i++)
		if (b[i] == 1) {
			b[i] = s+1;
			break;
		} 
	}
	
	for (i=0; i<n; i++)
		cout << b[i] << " ";
}