input: Write a function to solve a maze using an object-oriented approach in Python. The function should create a Maze class that can initialize a maze grid and solve it. The solution should be returned as a list of values representing the path from the start to the end of the maze. If the method finds a solution, it should return the result; if not, it should return an empty list.
  assert solve_maze(3, 3, [[1, 1, 1], [0, 1, 0], [1, 1, 1]]) == [(0, 0), (0, 1), (1, 1), (2, 1), (2, 2)]
  assert solve_maze(2, 2, [[1, 0], [1, 1]]) == [(0, 0), (1, 0), (1, 1)]
  assert solve_maze(2, 2, [[1, 0], [0, 1]]) == []
  assert solve_maze(1, 1, [[1]]) == [(0, 0)]
  assert solve_maze(0, 0, []) == []
output: def solve_maze(rows, cols, grid):
      class Maze:
          def __init__(self, grid):
              self.grid = grid
              self.rows = len(grid)
              self.cols = len(grid[0]) if self.rows > 0 else 0
              self.start = (0, 0)
              self.end = (self.rows - 1, self.cols - 1)
              self.directions = [(0, 1), (1, 0), (0, -1), (-1, 0)]
  
          def is_valid(self, x, y):
              return 0 <= x < self.rows and 0 <= y < self.cols and self.grid[x][y] == 1
  
          def solve(self):
              stack = [(self.start, [self.start])]
              visited = set()
              while stack:
                  (x, y), path = stack.pop()
                  if (x, y) == self.end:
                      return path
                  if (x, y) not in visited:
                      visited.add((x, y))
                      for dx, dy in self.directions:
                          nx, ny = x + dx, y + dy
                          if self.is_valid(nx, ny):
                              stack.append(((nx, ny), path + [(nx, ny)]))
              return []
  
      maze = Maze(grid)
      return maze.solve()