def recover_path(goal: tuple, path_to: dict) -> list:
    """Recover and return the path from start to goal."""
    path = [goal]
    previous = path_to[goal]
    while previous:
        path.append(previous)
        previous = path_to[previous]
    path.reverse()
    return path