input: Write a function to solve a maze using an object-oriented structure in Python. The function should create a `Maze` class that initializes a grid based on the given dimensions `n` and `m`. The class should contain a method `solve_maze()` to find a path from the start position `(0, 0)` to the end position `(n-1, m-1)` in the grid. The grid is filled with values where `1` represents a path and `0` represents a wall. The `solve_maze()` method should return the path as a list of positions if a path exists, or `None` if no path exists.
  
  class Maze:
      def __init__(self, n, m):
          self._n, self._m = n, m
          self._grid = [[None] * m for _ in range(n)]
  
      def solve_maze(self):
          result, found = [], False
          start, end = (0, 0), (self._n-1, self._m-1)
  
          for i in range(self._n):
              for j in range(self._m):
                  if self._grid[i][j] == 1:
                      value = 0
                      self._find_omega(i, j, value, result, start, end, found)
                      return result
  
      def _find_omega(self, i, j, value, result, start, end, found):
          rowNbr, colNbr = [-1, 0, 0, 1], [0, -1, 1, 0]
  
          if (i, j) == end:
              found = True
              result.append(value)
              return
  
          if found == True:
              return
          
          self._grid[i][j] = 0
          for k in range(4):
              if self._on_board(i + rowNbr[k], j + colNbr[k]):
                  self._find_omega(i + rowNbr[k], j + colNbr[k], value + 1, result, start, end, found)
  
      def _on_board(self, i, j):
          return 0 <= i < self._n and 0 <= j < self._m and self._grid[i][j] == 1
  
  assert Maze(3, 3)._grid == [[None, None, None], [None, None, None], [None, None, None]]
  assert Maze(2, 2)._grid == [[None, None], [None, None]]
  assert Maze(3, 3).solve_maze() == []  # assuming no path exists for now
  assert Maze(2, 2).solve_maze() == []  # assuming no path exists for now
output: class Maze:
      def __init__(self, n, m):
          self._n, self._m = n, m
          self._grid = [[None] * m for _ in range(n)]
  
      def solve_maze(self):
          start, end = (0, 0), (self._n-1, self._m-1)
          queue = [(start, [start])]
          visited = set()
          
          while queue:
              (current, path) = queue.pop(0)
              if current == end:
                  return path
              if current in visited:
                  continue
              visited.add(current)
              for neighbor in self._get_neighbors(current):
                  if neighbor not in visited:
                      queue.append((neighbor, path + [neighbor]))
          return None
  
      def _get_neighbors(self, pos):
          row, col = pos
          neighbors = []
          directions = [(-1, 0), (1, 0), (0, -1), (0, 1)]
          for dr, dc in directions:
              new_row, new_col = row + dr, col + dc
              if 0 <= new_row < self._n and 0 <= new_col < self._m and self._grid[new_row][new_col] == 1:
                  neighbors.append((new_row, new_col))
          return neighbors