smart solution
\nclass Solution:\n    def findBall(self, grid: List[List[int]]) -> List[int]:\n        lev=0\n        m=len(grid)\n        n=len(grid[0])\n        ans=[-1]*n\n
```\nclass Solution:\n    def findBall(self, grid: List[List[int]]) -> List[int]:\n        lev=0\n        m=len(grid)\n        n=len(grid[0])\n        ans=[-1]*n\n        for x in range(n):\n            i=0\n            j=x\n            a=grid[i][j]\n            while(i<m and 0<=j<n):\n                a=grid[i][j]\n                if(not 0<=j+a<n):\n                    break\n                a2=grid[i][j+a]\n                if(0<=j+a<n and a*a2>0):\n                    j+=a\n                    i+=1\n                else:\n                    break\n            if(i==m and 0<=j<n):\n                ans[x]=j\n        return(ans)\n```
['Python']