class Maze:
    def __init__(self, cells, width, height, start, exit_cell):
        self.cells = cells
        self.width = width
        self.height = height

        self.start = start
        self.exit = exit_cell

    def get_cell(self, x, y):
        if 0 <= y < self.height and 0 <= x < self.width:
            return self.cells[y][x]

        return None

    def get_neighbors(self, cell):
        directions = [
            (0, -1),
            (0, 1),
            (-1, 0),
            (1, 0)
        ]

        neighbors = []

        for dx, dy in directions:
            nx = cell.x + dx
            ny = cell.y + dy

            neighbor = self.get_cell(nx, ny)

            if neighbor and neighbor.is_passable():
                neighbors.append(neighbor)

        return neighbors