def convert_line_graph_path(path: list) -> list:
    """
    Converts the given shortest path for the line graph into the min cost path in the original path. In principle, this
    means extracting the nodes in the right order from the given line graph path. The given line-graph path looks like:
    (n1, n2), (n3, n4) ... (ni, ni+1) where each (ni,nj) is a node in the line graph, and each ni is a node in the
    original graph. The nodes in (ni, nj) are ordered so that ni < nj. So we need to determine the "right order" to
    extract the path, by determining the nodes that are the same.

    Example:
    line graph path: (10, 11), (9, 10), (8, 9), (8, 14) represents the path: 11 -> 10 -> 9 -> 8 -> 14,
    This means the interpretation of line graph path is: (11, 10), (10, 9), (9, 8), (8, 14)
    and the returned path: (11, 10, 9, 8, 14)
    :param path: the shortest path on the line graph
    :return: the equivalent min cost path on the original graph
    """
    # finding the source and target node from the first path element
    node_a = path[0][0]
    node_b = path[0][1]
    if node_a == path[1][0] or node_a == path[1][1]:
        node_source = node_b
        node_target = node_a
    else:
        node_source = node_a
        node_target = node_b
    converted_path = [node_source]
    node_source = node_target

    # iterate over path, adding the next node ni
    for i in range(1, len(path)):
        node_a = path[i][0]
        node_b = path[i][1]
        if node_a == node_source:
            node_target = node_b
        else:
            node_target = node_a
        converted_path.append(node_source)
        node_source = node_target
    converted_path.append(node_source)  # add the last node

    return converted_path