/**
 * Given two lists, appends all the elements of the second list to the end of the first list without using the built-in append() function.
 * Then, executes a nested loop to iterate through the lists and print all possible unique pairs of elements from the two lists.
 */
fun appendNestedElements(list1: MutableList<Int>, list2: List<Int>) {

    // Appending elements to the first list
    for (i in list2.indices) {
        val j = list1.size
        list1.addAll(j, listOf(list2[i]))
    }

    // Executing the nested loop
    for (i in list1.indices) {
        for (j in list1.indices) {
            if (i != j) {  // Exclude same element pairs
                println("Pair: (${list1[i]}, ${list1[j]})")
            }
        }
    }
}
/**
 * Given two lists, appends all the elements of the second list to the end of the first list without using the built-in append() function.
 * Then, executes a nested loop to iterate through the lists and print all possible unique pairs of elements from the two lists.
 */
fun appendNestedElements(list1: MutableList<Int>, list2: List<Int>) {
/**
 * Given two lists, appends all the elements of the second list to the end of the first list without using the built-in append() function.
 * Then, executes a nested loop to iterate through the lists and print all possible unique pairs of elements from the two lists.
 */
fun appendNestedElements(list1: MutableList<Int>, list2: List<Int>) {

    // Appending elements to the first list
    for (i in list2.indices) {
        val j = list1.size
        list1.addAll(j, listOf(list2[i]))
    }

    // Executing the nested loop
    for (i in list1.indices) {
        for (j in list1.indices) {
            if (i != j) {  // Exclude same element pairs
                println("Pair: (${list1[i]}, ${list1[j]})")
            }
        }
    }
}