/**
 * This function takes in a list of tuples and finds the common values across all tuples at the same index position.
 *
 * @param tupleList A list of tuples where each tuple represents a set of values.
 * @return A tuple containing the common values at each index position.
 */
fun findCommonValues(tupleList: List<List<Any>>): List<Any> {

    // Initialize an empty list to store the common values
    val commonValues = mutableListOf<Any>()

    // Iterate over the first tuple in the list
    for (value in tupleList[0]) {
        // Flag to check if the value is common across all tuples
        var isCommon = true

        // Iterate over the remaining tuples
        for (t in tupleList.subList(1, tupleList.size)) {
            // Check if the value is present in the current tuple
            if (value !in t) {
                // If the value is not present, set the isCommon flag to false and break the loop
                isCommon = false
                break
            }
        }

        // If the value is common across all tuples, append it to the commonValues list
        if (isCommon) {
            commonValues.add(value)
        }
    }

    return commonValues
}
/**
 * This function takes in a list of tuples and finds the common values across all tuples at the same index position.
 *
 * @param tupleList A list of tuples where each tuple represents a set of values.
 * @return A tuple containing the common values at each index position.
 */
fun findCommonValues(tupleList: List<List<Any>>): List<Any> {
/**
 * This function takes in a list of tuples and finds the common values across all tuples at the same index position.
 *
 * @param tupleList A list of tuples where each tuple represents a set of values.
 * @return A tuple containing the common values at each index position.
 */
fun findCommonValues(tupleList: List<List<Any>>): List<Any> {

    // Initialize an empty list to store the common values
    val commonValues = mutableListOf<Any>()

    // Iterate over the first tuple in the list
    for (value in tupleList[0]) {
        // Flag to check if the value is common across all tuples
        var isCommon = true

        // Iterate over the remaining tuples
        for (t in tupleList.subList(1, tupleList.size)) {
            // Check if the value is present in the current tuple
            if (value !in t) {
                // If the value is not present, set the isCommon flag to false and break the loop
                isCommon = false
                break
            }
        }

        // If the value is common across all tuples, append it to the commonValues list
        if (isCommon) {
            commonValues.add(value)
        }
    }

    return commonValues
}