/**
 * Given a tuple containing sets, find the intersection of all sets within the tuple.
 *
 * @param tuplesSet A tuple containing sets.
 * @param setsSet A set of elements.
 * @return The intersection of all sets within the tuple.
 */
fun intersectionOfTuplesAndSets(tuplesSet: List<Set<Any>>, setsSet: Set<Any>): Set<Any> {

    // Initialize the intersection set with the first set in the tuple
    var intersection = tuplesSet[0].toMutableSet()

    // Iterate through the remaining sets in the tuple
    for (i in 1 until tuplesSet.size) {
        // Perform intersection with the current set
        intersection.retainAll(tuplesSet[i])
    }

    // Intersection of all sets within the tuple
    return intersection
}
/**
 * Given a tuple containing sets, find the intersection of all sets within the tuple.
 *
 * @param tuplesSet A tuple containing sets.
 * @param setsSet A set of elements.
 * @return The intersection of all sets within the tuple.
 */
fun intersectionOfTuplesAndSets(tuplesSet: List<Set<Any>>, setsSet: Set<Any>): Set<Any> {
/**
 * Given a tuple containing sets, find the intersection of all sets within the tuple.
 *
 * @param tuplesSet A tuple containing sets.
 * @param setsSet A set of elements.
 * @return The intersection of all sets within the tuple.
 */
fun intersectionOfTuplesAndSets(tuplesSet: List<Set<Any>>, setsSet: Set<Any>): Set<Any> {

    // Initialize the intersection set with the first set in the tuple
    var intersection = tuplesSet[0].toMutableSet()

    // Iterate through the remaining sets in the tuple
    for (i in 1 until tuplesSet.size) {
        // Perform intersection with the current set
        intersection.retainAll(tuplesSet[i])
    }

    // Intersection of all sets within the tuple
    return intersection
}