/**
 * Given two lists, lst1 and lst2, find the intersection of the nested sets within the lists.
 *
 * @param lst1 The first list containing nested sets.
 * @param lst2 The second list containing nested sets.
 * @return A list containing the common elements found in the nested sets of both lists.
 *
 * Example:
 * lst1 = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
 * lst2 = [[2, 3, 4], [5, 6, 7], [8, 9, 10]]
 * intersectionNestedSetsRange(lst1, lst2) -> [2, 3, 5, 6, 8, 9]
 */
fun intersectionNestedSetsRange(lst1: List<List<Int>>, lst2: List<List<Int>>): List<Int> {

    val intersection = mutableListOf<Int>()
    for (set1 in lst1) {
        for (set2 in lst2) {
            val commonElements = set1.intersect(set2)
            intersection.addAll(commonElements)
        }
    }
    return intersection
}
/**
 * Given two lists, lst1 and lst2, find the intersection of the nested sets within the lists.
 *
 * @param lst1 The first list containing nested sets.
 * @param lst2 The second list containing nested sets.
 * @return A list containing the common elements found in the nested sets of both lists.
 *
 * Example:
 * lst1 = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
 * lst2 = [[2, 3, 4], [5, 6, 7], [8, 9, 10]]
 * intersectionNestedSetsRange(lst1, lst2) -> [2, 3, 5, 6, 8, 9]
 */
fun intersectionNestedSetsRange(lst1: List<List<Int>>, lst2: List<List<Int>>): List<Int> {
/**
 * Given two lists, lst1 and lst2, find the intersection of the nested sets within the lists.
 *
 * @param lst1 The first list containing nested sets.
 * @param lst2 The second list containing nested sets.
 * @return A list containing the common elements found in the nested sets of both lists.
 *
 * Example:
 * lst1 = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
 * lst2 = [[2, 3, 4], [5, 6, 7], [8, 9, 10]]
 * intersectionNestedSetsRange(lst1, lst2) -> [2, 3, 5, 6, 8, 9]
 */
fun intersectionNestedSetsRange(lst1: List<List<Int>>, lst2: List<List<Int>>): List<Int> {

    val intersection = mutableListOf<Int>()
    for (set1 in lst1) {
        for (set2 in lst2) {
            val commonElements = set1.intersect(set2)
            intersection.addAll(commonElements)
        }
    }
    return intersection
}