/**
 * This function takes in two lists and returns a pair containing the common elements
 * in both lists. If there are no common elements, an appropriate error message is raised.
 *
 * @param list1 A list of elements
 * @param list2 Another list of elements
 * @return A pair containing the common elements in both lists
 * @throws IllegalArgumentException If no common elements are found in the lists
 */
fun findCommonElements(list1: List<Any>, list2: List<Any>): Pair<Set<Any>, Set<Any>> {

    val commonElements = (list1.toSet() intersect list2.toSet())

    if (commonElements.isEmpty()) {
        throw IllegalArgumentException("No common elements found between the two lists!")
    }

    return Pair(list1.toSet(), list2.toSet())
}
/**
 * This function takes in two lists and returns a pair containing the common elements
 * in both lists. If there are no common elements, an appropriate error message is raised.
 *
 * @param list1 A list of elements
 * @param list2 Another list of elements
 * @return A pair containing the common elements in both lists
 * @throws IllegalArgumentException If no common elements are found in the lists
 */
fun findCommonElements(list1: List<Any>, list2: List<Any>): Pair<Set<Any>, Set<Any>> {
/**
 * This function takes in two lists and returns a pair containing the common elements
 * in both lists. If there are no common elements, an appropriate error message is raised.
 *
 * @param list1 A list of elements
 * @param list2 Another list of elements
 * @return A pair containing the common elements in both lists
 * @throws IllegalArgumentException If no common elements are found in the lists
 */
fun findCommonElements(list1: List<Any>, list2: List<Any>): Pair<Set<Any>, Set<Any>> {

    val commonElements = (list1.toSet() intersect list2.toSet())

    if (commonElements.isEmpty()) {
        throw IllegalArgumentException("No common elements found between the two lists!")
    }

    return Pair(list1.toSet(), list2.toSet())
}