/**
 * Write a function that takes in two lists of integers and prints the common elements between them using an infinite loop.
 *
 * @param list1 a list of integers
 * @param list2 a list of integers
 */
fun printCommonElements(list1: List<Int>, list2: List<Int>) {

    var i = 0
    var j = 0
    while (true) {
        if (i == list1.size) {
            i = 0
        }
        if (j == list2.size) {
            j = 0
        }

        if (list1[i] == list2[j]) {
            println(list1[i])
        }

        i++
        j++
    }
}
/**
 * Write a function that takes in two lists of integers and prints the common elements between them using an infinite loop.
 *
 * @param list1 a list of integers
 * @param list2 a list of integers
 */
fun printCommonElements(list1: List<Int>, list2: List<Int>) {
/**
 * Write a function that takes in two lists of integers and prints the common elements between them using an infinite loop.
 *
 * @param list1 a list of integers
 * @param list2 a list of integers
 */
fun printCommonElements(list1: List<Int>, list2: List<Int>) {

    var i = 0
    var j = 0
    while (true) {
        if (i == list1.size) {
            i = 0
        }
        if (j == list2.size) {
            j = 0
        }

        if (list1[i] == list2[j]) {
            println(list1[i])
        }

        i++
        j++
    }
}