#include <stdio.h>
#include <stdlib.h>

int main(){
    int n, h, left, right, sum;

    scanf("%d %d", &h, &n);
    int wf[h][n], rc[n], rn[n];

    for(int i = 0; i < n; i++){
        rc[i] = 1;
        rn[i] = 0;
    }
    for(int i = 0; i < h; i++) for(int j = 0; j < n; j++) scanf("%d", &wf[i][j]);

    void next(){
        for(int i = 0; i < n; i++){
            rc[i] = rn[i];
            rn[i] = 0;
        }
    }

    for(int i = 0; i < h; i++){
        for(int j = 0; j < n; j++){
            if(wf[i][j] == 1) rn[j] == rc[j];
            else{
                sum = 0;
                for(int k = j; wf[i][k] == 0; k--){
                    left = k;
                    sum += rc[k];
                }
                for(int k = j; wf[i][k] == 0; k++){
                    right = k;
                    sum += rc[k];
                }
                sum -= rc[j];
                if(left == 0) rn[right + 1] += sum;
                else if(right == (n - 1)) rn[left + 1] += sum;
                else{
                    if(sum % 2 == 0){
                        rn[right + 1] += (sum / 2);
                        rn[left + 1] += (sum / 2);
                    }else{
                        if(i % 2 == 0){
                            rn[right + 1] += (sum / 2) + 1;
                            rn[left + 1] += (sum / 2);
                        }else{
                            rn[right + 1] += (sum / 2);
                            rn[left + 1] += (sum / 2) + 1;
                        }
                    }
                }
            }

            next();
        }
    }

    for(int i = 0; i < n; i++) printf("%d ", rc[i]);


    return 0;
}