/**
 * Given two lists of objects, this function finds the objects that are present in both lists.
 *
 * @param objects1 A list of objects.
 * @param objects2 A list of objects.
 * @return A list of objects that appear in both lists.
 *
 * Example:
 * objects1 = listOf(Pair("Earth", "Sun"), Pair("Moon", "Saturn"), Pair("Jupiter", "Mars"))
 * objects2 = listOf(Pair("Earth", "Saturn"), Pair("Mars", "Sun"), Pair("Pluto", "Venus"))
 * findSimilarObjects(objects1, objects2) will return listOf(Pair("Earth", "Sun"), Pair("Mars", "Sun"))
 */
fun findSimilarObjects(objects1: List<Pair<String, String>>, objects2: List<Pair<String, String>>): List<Pair<String, String>> {

    val similarObjects = mutableListOf<Pair<String, String>>()

    // Loop through each object in objects1
    for (obj1 in objects1) {
        // Loop through each object in objects2
        for (obj2 in objects2) {
            // Compare the pairs
            if (obj1 == obj2) {
                similarObjects.add(obj1)
            }
        }
    }

    return similarObjects
}
/**
 * Given two lists of objects, this function finds the objects that are present in both lists.
 *
 * @param objects1 A list of objects.
 * @param objects2 A list of objects.
 * @return A list of objects that appear in both lists.
 *
 * Example:
 * objects1 = listOf(Pair("Earth", "Sun"), Pair("Moon", "Saturn"), Pair("Jupiter", "Mars"))
 * objects2 = listOf(Pair("Earth", "Saturn"), Pair("Mars", "Sun"), Pair("Pluto", "Venus"))
 * findSimilarObjects(objects1, objects2) will return listOf(Pair("Earth", "Sun"), Pair("Mars", "Sun"))
 */
fun findSimilarObjects(objects1: List<Pair<String, String>>, objects2: List<Pair<String, String>>): List<Pair<String, String>> {
/**
 * Given two lists of objects, this function finds the objects that are present in both lists.
 *
 * @param objects1 A list of objects.
 * @param objects2 A list of objects.
 * @return A list of objects that appear in both lists.
 *
 * Example:
 * objects1 = listOf(Pair("Earth", "Sun"), Pair("Moon", "Saturn"), Pair("Jupiter", "Mars"))
 * objects2 = listOf(Pair("Earth", "Saturn"), Pair("Mars", "Sun"), Pair("Pluto", "Venus"))
 * findSimilarObjects(objects1, objects2) will return listOf(Pair("Earth", "Sun"), Pair("Mars", "Sun"))
 */
fun findSimilarObjects(objects1: List<Pair<String, String>>, objects2: List<Pair<String, String>>): List<Pair<String, String>> {

    val similarObjects = mutableListOf<Pair<String, String>>()

    // Loop through each object in objects1
    for (obj1 in objects1) {
        // Loop through each object in objects2
        for (obj2 in objects2) {
            // Compare the pairs
            if (obj1 == obj2) {
                similarObjects.add(obj1)
            }
        }
    }

    return similarObjects
}