input: 
  def solve_maze(maze_grid: List[List[int]]) -> List[int]:
      """ Solve the given maze represented by a 2D grid where 1's represent traversable paths.
      The function should return a list representing the shortest path from the top-left corner to the bottom-right corner.
      For instance, each element in the list should represent the movement from one cell to the next.
      For example, if the maze grid is:
      [
          [1, 0, 1],
          [1, 1, 1],
          [0, 1, 1]
      ]
      The output will be:
      [0, 1, 2, 1, 0, -1, -2, -1]
      indicating the path taken:
      0 -> move right,
      1 -> move down,
      2 -> move right,
      1 -> move down,
      0 -> move right,
      -1 -> move up,
      -2 -> move left,
      -1 -> move up
      >>> solve_maze([[1, 0, 1], [1, 1, 1], [0, 1, 1]])
      [0, 1, 2, 1, 0, -1, -2, -1]
      """
  
output:     
      from collections import deque
  
      def get_neighbors(x, y, n, m):
          neighbors = []
          if x > 0: neighbors.append((x-1, y, -1))
          if x < n-1: neighbors.append((x+1, y, 1))
          if y > 0: neighbors.append((x, y-1, -2))
          if y < m-1: neighbors.append((x, y+1, 2))
          return neighbors
  
      n, m = len(maze_grid), len(maze_grid[0])
      queue = deque([(0, 0, [])])
      visited = set()
      visited.add((0, 0))
  
      while queue:
          x, y, path = queue.popleft()
          if (x, y) == (n-1, m-1):
              return path
          for nx, ny, move in get_neighbors(x, y, n, m):
              if (nx, ny) not in visited and maze_grid[nx][ny] == 1:
                  visited.add((nx, ny))
                  queue.append((nx, ny, path + [move]))
  
      return []
  