input: Write a function to create an object-oriented structure to solve a maze using Python. The function should initialize a Maze object with dimensions n and m, and it should be able to solve the maze by finding a path from the top-left corner to the bottom-right corner. The maze is represented by a 2D grid where 1 indicates a passable cell and 0 indicates a blocked cell. The function should return a list of integers representing the path length from the start to the end if a solution exists, otherwise it should return an empty list.
  
  Maze(3, 3)
  assert Maze(3, 3).solve_maze() == []
  
  Maze(3, 3)
  assert Maze(3, 3).solve_maze() == []
  
  Maze(3, 3)
  assert Maze(3, 3).solve_maze() == []
  
  Maze(3, 3)
  assert Maze(3, 3).solve_maze() == []
  
  Maze(3, 3)
  assert Maze(3, 3).solve_maze() == []
output: def solve_maze(self):
      def is_valid(x, y):
          return 0 <= x < self.n and 0 <= y < self.m and self.grid[x][y] == 1
  
      def dfs(x, y, path):
          if x == self.n - 1 and y == self.m - 1:
              return path
          for dx, dy in [(-1, 0), (1, 0), (0, -1), (0, 1)]:
              nx, ny = x + dx, y + dy
              if is_valid(nx, ny) and (nx, ny) not in visited:
                  visited.add((nx, ny))
                  result = dfs(nx, ny, path + [(nx, ny)])
                  if result:
                      return result
          return []
  
      self.grid = [[1] * self.m for _ in range(self.n)]
      visited = set()
      visited.add((0, 0))
      path = dfs(0, 0, [(0, 0)])
      return [len(path) - 1] if path else []