input: Write a function to create an object-oriented structure in Python to solve a maze, given the Maze class definition provided. The maze is represented by a grid of n x m dimensions, where each cell can be either part of the path (denoted by `1`) or an obstacle (denoted by `0` or `None`). The objective is to find a path from the top-left corner of the grid (coordinate `(0, 0)`) to the bottom-right corner (coordinate `(n-1, m-1)`). If a path exists, the function should return a list of integers representing the path length at each step from the start to the end. If no path exists, it should return an empty list. The function should be named `solve_maze_path` and it should use the provided `Maze` class.
  assert solve_maze_path(3, 3, [[1, 0, 0], [1, 1, 0], [0, 1, 1]]) == [2, 1, 0]
  assert solve_maze_path(3, 3, [[1, 1, 0], [0, 1, 0], [0, 1, 1]]) == [1, 0]
  assert solve_maze_path(3, 3, [[1, 0, 0], [0, 0, 0], [0, 1, 1]]) == []
  assert solve_maze_path(3, 3, [[1, 1, 1], [1, 0, 1], [1, 1, 1]]) == [2, 1, 2, 3]
  assert solve_maze_path(3, 3, [[0, 0, 0], [0, 0, 0], [0, 0, 0]]) == []
output: def solve_maze_path(n, m, grid):
      from collections import deque
  
      def is_valid(x, y):
          return 0 <= x < n and 0 <= y < m and grid[x][y] == 1
  
      directions = [(0, 1), (1, 0), (0, -1), (-1, 0)]
      queue = deque([(0, 0, 0)])
      visited = set()
      visited.add((0, 0))
  
      while queue:
          x, y, dist = queue.popleft()
          if (x, y) == (n-1, m-1):
              return [dist - i for i in range(dist + 1)]
          for dx, dy in directions:
              nx, ny = x + dx, y + dy
              if is_valid(nx, ny) and (nx, ny) not in visited:
                  visited.add((nx, ny))
                  queue.append((nx, ny, dist + 1))
  
      return []