from collections import deque

class BFSStrategy:
    def find_path(self, maze, start, exit_):
        queue = deque([start])
        parent = {start: None}
        visited = {start}

        while queue:
            cur = queue.popleft()

            if cur == exit_:
                return self._reconstruct(parent, start, exit_), visited

            for n in maze.get_neighbors(cur):
                if n not in visited:
                    visited.add(n)
                    parent[n] = cur
                    queue.append(n)

        return None, visited

    def _reconstruct(self, parent, start, exit_):
        path = []
        cur = exit_
        while cur:
            path.append(cur)
            cur = parent[cur]
        return list(reversed(path))
