/**
 * This function appends an element to a list if it is not already present in the intersection of two sets.
 *
 * @param element The element to be appended to the list.
 * @param lst The list to which the element will be appended.
 * @param set1 The first set to compare intersection with.
 * @param set2 The second set to compare intersection with.
 * @return The updated list.
 */
fun appendElementToList(element: Any, lst: MutableList<Any>, set1: Set<Any>, set2: Set<Any>): MutableList<Any> {

    val intersection = set1.intersect(set2)  // Find the intersection of the two sets
    if (element !in intersection) {  // Check if the element is not in the intersection
        lst.add(element)  // Append the element to the list
    }
    return lst  // Return the updated list
}
/**
 * This function appends an element to a list if it is not already present in the intersection of two sets.
 *
 * @param element The element to be appended to the list.
 * @param lst The list to which the element will be appended.
 * @param set1 The first set to compare intersection with.
 * @param set2 The second set to compare intersection with.
 * @return The updated list.
 */
fun appendElementToList(element: Any, lst: MutableList<Any>, set1: Set<Any>, set2: Set<Any>): MutableList<Any> {
/**
 * This function appends an element to a list if it is not already present in the intersection of two sets.
 *
 * @param element The element to be appended to the list.
 * @param lst The list to which the element will be appended.
 * @param set1 The first set to compare intersection with.
 * @param set2 The second set to compare intersection with.
 * @return The updated list.
 */
fun appendElementToList(element: Any, lst: MutableList<Any>, set1: Set<Any>, set2: Set<Any>): MutableList<Any> {

    val intersection = set1.intersect(set2)  // Find the intersection of the two sets
    if (element !in intersection) {  // Check if the element is not in the intersection
        lst.add(element)  // Append the element to the list
    }
    return lst  // Return the updated list
}