/**
 * Given two nested lists representing geological data, find the common elements between them.
 *
 * @param arr1 The first nested list.
 * @param arr2 The second nested list.
 * @return A list of common elements found in both nested lists.
 */
fun findCommonElements(arr1: List<List<Int>>, arr2: List<List<Int>>): List<Int> {

    val commonElements = mutableListOf<Int>()

    for (subList1 in arr1) {
        for (subList2 in arr2) {
            for (elem1 in subList1) {
                for (elem2 in subList2) {
                    if (elem1 == elem2) {
                        commonElements.add(elem1)
                    }
                }
            }
        }
    }

    return commonElements
}
/**
 * Given two nested lists representing geological data, find the common elements between them.
 *
 * @param arr1 The first nested list.
 * @param arr2 The second nested list.
 * @return A list of common elements found in both nested lists.
 */
fun findCommonElements(arr1: List<List<Int>>, arr2: List<List<Int>>): List<Int> {
/**
 * Given two nested lists representing geological data, find the common elements between them.
 *
 * @param arr1 The first nested list.
 * @param arr2 The second nested list.
 * @return A list of common elements found in both nested lists.
 */
fun findCommonElements(arr1: List<List<Int>>, arr2: List<List<Int>>): List<Int> {

    val commonElements = mutableListOf<Int>()

    for (subList1 in arr1) {
        for (subList2 in arr2) {
            for (elem1 in subList1) {
                for (elem2 in subList2) {
                    if (elem1 == elem2) {
                        commonElements.add(elem1)
                    }
                }
            }
        }
    }

    return commonElements
}