/**
 * Given a list of sets, find the XOR of all possible pairs of elements from the sets.
 *
 * @param n The number of sets in the list.
 * @param setList A list of n sets, where each set contains distinct integers.
 * @return The XOR of all possible pairs of elements.
 *
 * Example:
 * xorOperation(3, setOf(setOf(1, 3, 5), setOf(2, 4), setOf(6, 7))) // 5
 */
fun xorOperation(n: Int, setList: List<Set<Int>>): Int {

    var xorResult = 0
    for (i in 0 until n) {
        for (j in i + 1 until n) { // Loop through remaining sets
            for (num1 in setList[i]) {
                for (num2 in setList[j]) {
                    xorResult = xorResult xor (num1 xor num2)
                }
            }
        }
    }
    return xorResult
}
/**
 * Given a list of sets, find the XOR of all possible pairs of elements from the sets.
 *
 * @param n The number of sets in the list.
 * @param setList A list of n sets, where each set contains distinct integers.
 * @return The XOR of all possible pairs of elements.
 *
 * Example:
 * xorOperation(3, setOf(setOf(1, 3, 5), setOf(2, 4), setOf(6, 7))) // 5
 */
fun xorOperation(n: Int, setList: List<Set<Int>>): Int {
/**
 * Given a list of sets, find the XOR of all possible pairs of elements from the sets.
 *
 * @param n The number of sets in the list.
 * @param setList A list of n sets, where each set contains distinct integers.
 * @return The XOR of all possible pairs of elements.
 *
 * Example:
 * xorOperation(3, setOf(setOf(1, 3, 5), setOf(2, 4), setOf(6, 7))) // 5
 */
fun xorOperation(n: Int, setList: List<Set<Int>>): Int {

    var xorResult = 0
    for (i in 0 until n) {
        for (j in i + 1 until n) { // Loop through remaining sets
            for (num1 in setList[i]) {
                for (num2 in setList[j]) {
                    xorResult = xorResult xor (num1 xor num2)
                }
            }
        }
    }
    return xorResult
}