using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication28
{
    class Program
    {
        static void ucitaj(int[,] a, int n, int m)
        {
            string[] s;
            for (int r = 0; r < n; r++)
            {
                s = Console.ReadLine().Split();
                for (int k = 0; k < m; k++)
                {
                    a[r, k] = int.Parse(s[k]);
                }
            }
        }
        static void Main(string[] args)
        {
            int n, m;
            string[] s;
            s=Console.ReadLine().Split();
            n = int.Parse(s[0]);
            m = int.Parse(s[1]);
            int[,] mat=new int[n,m];
            ucitaj(mat, n, m);
            for (int r = 0; r < n; r++)
            {
                for (int k = 0; k < m; k++)
                {
                    if (r % 2 != 0)
                    {
                        if (mat[r, k] == 0)
                        {
                            if (k == m-1)
                            {
                                mat[r, k - 1]++;
                            }
                            else
                                mat[r, k + 1]++;
                        }
                    }
                    else
                    {
                        if (mat[r, k] == 0)
                        {
                            if (k == 0)
                            {
                                mat[r, k + 1]++;
                            }
                            else
                                mat[r, k - 1]++;
                        }
                    }
                }
            }
            for (int i = 0; i < m; i++)
            {
                Console.Write(mat[n-1, i] + " ");
            }
        }
    }
}