import copy


def _find_euler_cycle(graph_: list, start_vertex_i: int) -> list:
    """
    Find an eulerian path in the given 'graph'
    :param graph_: the graph object to examine. Graph is a list of tuples, whose [0] element is a list of indexes of
    vertices connected to the given one by an edge
    :param start_vertex_i: the index of a vertex to start eulerian path from
    :return: a list of indexes of vertices forming an eulerian path

    Note this function does NOT check balancity (eulericity) of the given graph
    """
    graph = []
    for vertex in graph_:
        graph.append(copy.copy(vertex[0]))

    cycle = [start_vertex_i]

    vertices_to_visit = [0]  # Indexes of vertices in a 'cycle' list
    while len(vertices_to_visit) > 0:
        current_cycle_start_i = vertices_to_visit.pop(0)
        current_start_vertex_i = cycle[current_cycle_start_i]
        if len(graph[current_start_vertex_i]) == 0:
            continue
        current_cycle = []  # Start vertex is already in the cycle

        current_vertex_i = current_start_vertex_i
        current_edges = graph[current_vertex_i]
        while len(current_edges) > 0:
            current_vertex_i = current_edges.pop(0)
            if len(current_edges) > 0:
                vertices_to_visit.append(current_cycle_start_i + len(current_cycle))
            current_cycle.append(current_vertex_i)
            current_edges = graph[current_vertex_i]

        for v in current_cycle[::-1]:
            cycle.insert(current_cycle_start_i + 1, v)

    return cycle