/**
 * You work as a lawyer and you have two lists: names and ages.
 * Your task is to find the common elements (tuples) between the two lists.
 * For every common tuple, print the name and age.
 *
 * @param names a list of names (strings)
 * @param ages a list of ages (integers)
 */
fun tupleIntersectionLoop(names: List<String>, ages: List<Int>) {

    val commonTuples = mutableListOf<Pair<String, Int>>()

    for (i in names.indices) {
        for (j in ages.indices) {
            if (names[i] == names[j] && ages[i] == ages[j] && Pair(names[i], ages[i]) !in commonTuples) {
                commonTuples.add(Pair(names[i], ages[i]))
            }
        }
    }

    for ((name, age) in commonTuples) {
        println("$name is $age years old.")
    }
}
/**
 * You work as a lawyer and you have two lists: names and ages.
 * Your task is to find the common elements (tuples) between the two lists.
 * For every common tuple, print the name and age.
 *
 * @param names a list of names (strings)
 * @param ages a list of ages (integers)
 */
fun tupleIntersectionLoop(names: List<String>, ages: List<Int>) {
/**
 * You work as a lawyer and you have two lists: names and ages.
 * Your task is to find the common elements (tuples) between the two lists.
 * For every common tuple, print the name and age.
 *
 * @param names a list of names (strings)
 * @param ages a list of ages (integers)
 */
fun tupleIntersectionLoop(names: List<String>, ages: List<Int>) {

    val commonTuples = mutableListOf<Pair<String, Int>>()

    for (i in names.indices) {
        for (j in ages.indices) {
            if (names[i] == names[j] && ages[i] == ages[j] && Pair(names[i], ages[i]) !in commonTuples) {
                commonTuples.add(Pair(names[i], ages[i]))
            }
        }
    }

    for ((name, age) in commonTuples) {
        println("$name is $age years old.")
    }
}