input: Write a function to create an object-oriented structure in Python to solve a maze. The function should be able to define a Maze class that initializes a grid and has methods to solve the maze and to recursively find the path from the start to the end of the maze.
  
  assert solve_maze((3, 3), [[1, 0, 0], [1, 1, 0], [0, 1, 1]])==[6]
  assert solve_maze((3, 3), [[1, 0, 0], [0, 1, 0], [0, 0, 1]])==[]
  assert solve_maze((2, 2), [[1, 1], [1, 1]])==[3]
  assert solve_maze((1, 1), [[1]])==[1]
  assert solve_maze((3, 3), [[0, 0, 0], [0, 1, 0], [0, 0, 0]])==[]
output: def solve_maze(size, grid):
      class Maze:
          def __init__(self, size, grid):
              self.size = size
              self.grid = grid
              self.path = []
              self.directions = [(0, 1), (1, 0), (0, -1), (-1, 0)]
  
          def is_valid(self, x, y):
              return 0 <= x < self.size[0] and 0 <= y < self.size[1] and self.grid[x][y] == 1
  
          def find_path(self, x, y):
              if not self.is_valid(x, y):
                  return False
              if (x, y) == (self.size[0] - 1, self.size[1] - 1):
                  self.path.append((x * self.size[1]) + y + 1)
                  return True
              self.grid[x][y] = -1
              for dx, dy in self.directions:
                  if self.find_path(x + dx, y + dy):
                      self.path.append((x * self.size[1]) + y + 1)
                      return True
              self.grid[x][y] = 1
              return False
  
          def solve(self):
              if self.find_path(0, 0):
                  return self.path[::-1]
              return []
  
      maze = Maze(size, grid)
      return maze.solve()