def cycles2perm(cycles):
    """
    Convert permutation in cycle notation to permutation in one-line notation

    :param cycles: Permutation in cycle notation
    :type cycles: list

    :return: Returns permutation in one-line notation
    :rtype: list
    """
    n = max([item for sublist in cycles for item in sublist])

    perm = [x for x in range(1, n + 1)]
    for i in range(n):
        for j in reversed(cycles):
            try:
                x = j.index(perm[i])
            except ValueError:
                continue
            else:
                if x == len(j) - 1:
                    perm[i] = j[0]
                else:
                    perm[i] = j[x + 1]

    return perm