def even(n):
    """Builds a set of cycles that a graph with even vertices."""
    assert n % 2 == 0

    # Base case for complete graph such that V = {1, 2, 3, 4}.
    cycles = [[1, 2, 3], [2, 3, 4], [3, 4, 1], [4, 1, 2]]

    for i in range(6, n + 1, 2):
        a, b = i, i - 1

        # Use edges (a, 1), (a, 0), (b, 1), (b, 0), (a, b) exactly twice each.
        cycles += [[a, 1, b], [a, 2, b], [a, 1, b, 2]]

        # Similar to odd(...) as we are left with 2n - 2 edges to use
        # connected to i - 4 of the vertices V' = {3 ... i - 2}. Notice that
        # |V'| is even so we can apply the same strategy as in odd(...).
        for k in range(3, i - 1, 2):
            c, d = k, k + 1
            cycles += [[a, c, b, d]] * 2

    return cycles