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

namespace Treci_Zadatak
{
    class GostiljskiV
    {
        int h, n;
        int[,] TV;
        int[] V;
        public GostiljskiV()
        {
            string[] t = Console.ReadLine().Split(' ');
            h = Convert.ToInt32(t[0]);
            n = Convert.ToInt32(t[1]);
            TV = new Int32[h, n];
            V = new int[n];
            for (int i = 0; i < h; i++)
            {
                t = Console.ReadLine().Split(' ');
                for (int j = 0; j < n; j++)
                {
                    TV[i, j] = Convert.ToInt32(t[j]);
                }
            }
            for (int i = 0; i < n; i++) V[i] = 1;
        }
        public void Rez()
        {
            for (int i = 0; i < h; i++)
            {
                Spust(i);
            }
        }
        private void Spust(int k)
        {
            for (int i = 0; i < n; i++)
            {
                if (TV[k, i] == 0 && V[i] != 0)
                {
                    Levo(V[i] / 2 + ((V[i] % 2 == 1 && k % 2 == 0) ? 1 : 0), k, i);
                    Desno(V[i] / 2 + ((V[i] % 2 == 1 && k % 2 == 1) ? 1 : 0), k, i);
                    V[i] = 0;
                }
            }
        }
        private void Levo(int kl, int a, int b)
        {
            int t = 0;
            if (kl == 0) return;
            while (TV[a, b - t] != 1)
            {
                if (b == 0) { Desno(kl, a, b - t); return; }
                t++;
            }
            V[b - t] += kl;
            return;
        }
        private void Desno(int kl, int a, int b)
        {
            int t = 0;
            if (kl == 0) return;
            while (TV[a, b + t] != 1)
            {
                if (b == n - 1) { Levo(kl, a, b + t); return; }
                t++;
            }
            V[b + t] += kl;
            return;
        }
        public void Ispis()
        {
            for (int i = 0; i < n; i++)
            {
                Console.Write(V[i] + " ");
            }
        }
    }
    class Program
    {
        static void Main(string[] args)
        {
            GostiljskiV V = new GostiljskiV();
            V.Rez();
            V.Ispis();
        }
    }
}