import queue


def path_from(g, s):
    """
    Returns the path to go to a vertex using a bfs
    :param g: Graph as an adjacency list
    :param s:
    :return: List l such that l[i] is the list of vertices to use to go to i from s
    """

    V = []  # List of visited vertices
    P = [None for k in range(len(g))]  # List of paths
    Q = queue.Queue()
    Q.put((s, []))

    while not Q.empty():
        u, p = Q.get()

        if u not in V:
            V += [u]
            for v in g[u]:
                Q.put((v, p + [u]))
            P[u] = p + [u]
    return P