/**
 * This function takes two tuples and two sets as input and returns a set containing the common elements of the tuples
 * that are also present in both sets.
 *
 * @param tuple1 The first tuple
 * @param tuple2 The second tuple
 * @param set1 The first set
 * @param set2 The second set
 * @return A set containing the common elements in both tuples and sets
 */
fun getCommonElements(tuple1: List<Any>, tuple2: List<Any>, set1: Set<Any>, set2: Set<Any>): Set<Any> {

    // Create an intersection of the two tuples
    val tupleIntersection = tuple1.toSet().intersect(tuple2.toSet())

    // Iterate through the first set to check if each element is present in the tuple intersection
    val commonElements = mutableSetOf<Any>()
    for (element in set1) {
        if (element in tupleIntersection) {
            commonElements.add(element)
        }
    }

    // Return the final set of common elements
    return commonElements
}
/**
 * This function takes two tuples and two sets as input and returns a set containing the common elements of the tuples
 * that are also present in both sets.
 *
 * @param tuple1 The first tuple
 * @param tuple2 The second tuple
 * @param set1 The first set
 * @param set2 The second set
 * @return A set containing the common elements in both tuples and sets
 */
fun getCommonElements(tuple1: List<Any>, tuple2: List<Any>, set1: Set<Any>, set2: Set<Any>): Set<Any> {
/**
 * This function takes two tuples and two sets as input and returns a set containing the common elements of the tuples
 * that are also present in both sets.
 *
 * @param tuple1 The first tuple
 * @param tuple2 The second tuple
 * @param set1 The first set
 * @param set2 The second set
 * @return A set containing the common elements in both tuples and sets
 */
fun getCommonElements(tuple1: List<Any>, tuple2: List<Any>, set1: Set<Any>, set2: Set<Any>): Set<Any> {

    // Create an intersection of the two tuples
    val tupleIntersection = tuple1.toSet().intersect(tuple2.toSet())

    // Iterate through the first set to check if each element is present in the tuple intersection
    val commonElements = mutableSetOf<Any>()
    for (element in set1) {
        if (element in tupleIntersection) {
            commonElements.add(element)
        }
    }

    // Return the final set of common elements
    return commonElements
}