#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);

    int h, n;

    cin >> h >> n;

    vector<int> ar(n), nxt(n, 1);

    int t = 1;
    while(h--)
    {
        int lstone = -1, sm = 0;

        for(int i = 0; i < n; i++)
        {
            cin >> ar[i];
        }

        if(n > 1)
        {
            for(int i = 0; i < n; i++)
            {
                if(ar[i] == 1)
                {
                    if(sm && lstone != -1)
                    {
                        if(sm%2 == 1)
                        {
                            if(t%2 == 0)
                            {
                                nxt[i] += sm/2 + 1;
                                nxt[lstone] += sm/2;
                            }
                            else
                            {
                                nxt[lstone] += sm/2 + 1;
                                nxt[i] += sm/2;
                            }
                        }
                        else
                        {
                            nxt[i] += sm/2;
                            nxt[lstone] += sm/2;
                        }

                    }
                    else if(sm)
                    {
                        nxt[i] += sm;
                    }

                    lstone = i;
                    sm = 0;
                }
                else
                {
                    if(i == n-1)
                    {
                        nxt[lstone]+= sm + nxt[i];
                        nxt[i] = 0;
                        sm = 0;
                    }
                    else
                    {
                        sm+=nxt[i];
                        nxt[i] = 0;
                    }
                }
            }

        }

        t++;

    }

    if(n==1)
    {
        cout << ar[0];
    }
    else
    {
        for(int i = 0; i < n; i++)
        {
            cout << nxt[i] << " ";
        }
    }
}