#include <bits/stdc++.h>
using namespace std;
vector<int>v;
int s ;
void sredi ( vector<int>t , int n) {
	vector<int>pom(s);
	for (int i = 0 ; i < s ; i++ ) pom[i] = 0;
	
	if ( n % 2 == 0 ) {
		// ka levo tece voda!
				int i1 = 0;
				int i2 = 0;
		for (int i = 0 ; i < s; i++ ) {
			if ( t[i] == 1 ) {
				pom[i] += v[i];
			}
			else {
				int a = v[i] / 2 + v[i] % 2 ;
				int b = v[i] / 2 ;
				bool nasao1 = false ;
				bool nasao2 = false ;
				for (int j = i-1; j >= 0 ; j-- ) {
					if ( t[j] == 1 ) {
						nasao1 = true ;
						pom[j]+= a ;
						i1= j;
						break;
					}
				}
				for (int j = i+1 ; j< s ; j++ ) {
					if ( t[j] == 1 ) {
						pom[j] += b ;
						if ( nasao1 == false ) {
							pom[j] += a ;
						}
						i2 = j ;
						nasao2 = true ;
						break;
					}
				}
				if ( nasao2 = false ) pom[i1] += b ;
			}
		}

	

	}
	else {
		// ka desno tece voda!
				int i1 = 0;
				int i2 = 0;
		for (int i = 0 ; i < s; i++ ) {
			if ( t[i] == 1 ) {
				pom[i] += v[i];
			}
			else {
				int a = v[i] / 2 ;
				int b = v[i] / 2 + v[i] % 2 ;
				bool nasao1 = false ;
				bool nasao2 = false ;
				for (int j = i-1; j >= 0 ; j-- ) {
					if ( t[j] == 1 ) {
						nasao1 = true ;
						pom[j]+= a ;
						i1= j;
						break;
					}
				}
				for (int j = i+1 ; j< s ; j++ ) {
					if ( t[j] == 1 ) {
						pom[j] += b ;
						if ( nasao1 == false ) {
							pom[j] += a ;
						}
						i2 = j ;
						nasao2 = true ;
						break;
					}
				}
				if ( nasao2 = false ) pom[i1] += b ;
			}
		}

	
	
	}


	for (int i = 0 ; i < s ; i++ ) v[i] = pom[i];
}
int main () {
	int h;
	cin >> h >> s ;
	vector<int>t(s);
	for (int i = 0 ; i < s ; i++ ) v.push_back(1);

	for (int i = 0 ; i < h ; i++ ) {
		for (int j = 0 ; j < s ; j++ ) {
			cin >> t[j];
		}
		sredi(t,i);
	}
	for (int i = 0 ; i < s; i++) cout << v[i] << ' ';
}