Try this
\n\n# Code\npython3 []\n\n\nclass Solution:\n    def findSafeWalk(self, grid: List[List[int]], health: int) -> bool:\n        m, n = len(grid), len(grid[0])\n  
\n\n# Code\n```python3 []\n\n\nclass Solution:\n    def findSafeWalk(self, grid: List[List[int]], health: int) -> bool:\n        m, n = len(grid), len(grid[0])\n        directions = [(0, 1), (1, 0), (0, -1), (-1, 0)]\n        \n        queue = deque([(0, 0, health - grid[0][0])])\n        visited = set([(0, 0, health - grid[0][0])])\n        \n        while queue:\n            r, c, h = queue.popleft()\n            \n            if (r, c) == (m - 1, n - 1) and h > 0:\n                return True\n            \n            for dr, dc in directions:\n                nr, nc = r + dr, c + dc\n                \n                if 0 <= nr < m and 0 <= nc < n:\n                    new_health = h - grid[nr][nc]\n                    \n                    if new_health > 0 and (nr, nc, new_health) not in visited:\n                        visited.add((nr, nc, new_health))\n                        queue.append((nr, nc, new_health))\n        \n        return False\n      \n```
['Python3']