/**
 * This function takes a tuple and an index as arguments and returns a list containing elements present 
 * at the given index in each tuple. If the index is out of range for any tuple, that tuple will be skipped.
 *
 * @param tup The tuple from which elements need to be extracted.
 * @param index The index at which elements are to be found.
 * @return A list containing elements present at the given index in each tuple.
 */
fun findElementsInTuple(tup: List<List<Any>>, index: Int): List<Any> {

    val result = mutableListOf<Any>()
    for (subTuple in tup) {
        try {
            val element = subTuple[index]
            result.add(element)
        } catch (e: IndexOutOfBoundsException) {
            continue
        }
    }
    return result
}
/**
 * This function takes a tuple and an index as arguments and returns a list containing elements present 
 * at the given index in each tuple. If the index is out of range for any tuple, that tuple will be skipped.
 *
 * @param tup The tuple from which elements need to be extracted.
 * @param index The index at which elements are to be found.
 * @return A list containing elements present at the given index in each tuple.
 */
fun findElementsInTuple(tup: List<List<Any>>, index: Int): List<Any> {
/**
 * This function takes a tuple and an index as arguments and returns a list containing elements present 
 * at the given index in each tuple. If the index is out of range for any tuple, that tuple will be skipped.
 *
 * @param tup The tuple from which elements need to be extracted.
 * @param index The index at which elements are to be found.
 * @return A list containing elements present at the given index in each tuple.
 */
fun findElementsInTuple(tup: List<List<Any>>, index: Int): List<Any> {

    val result = mutableListOf<Any>()
    for (subTuple in tup) {
        try {
            val element = subTuple[index]
            result.add(element)
        } catch (e: IndexOutOfBoundsException) {
            continue
        }
    }
    return result
}