/**
 * This function takes in a nested data structure and a list of
 * indices, and returns the value at the specified indices.
 *
 * @param data the nested data structure
 * @param indices the list of indices to access
 * @return the value at the specified indices
 *
 * Example:
 * accessNestedElements(listOf(listOf(listOf(1, 2), listOf(3, 4)), listOf(listOf(5, 6), listOf(7, 8))), listOf(1, 0, 1))
 * Output: 7
 */
fun accessNestedElements(data: Any, indices: List<Int>): Any {

    if (indices.isEmpty()) {
        return data
    } else {
        if (data is List<*>) {
            if (indices.size == 1) {
                return (data as List<Any>)[indices[0]]
            } else {
                return accessNestedElements((data as List<Any>)[indices[0]], indices.subList(1, indices.size))
            }
        } else {
            return data
        }
    }
}
/**
 * This function takes in a nested data structure and a list of
 * indices, and returns the value at the specified indices.
 *
 * @param data the nested data structure
 * @param indices the list of indices to access
 * @return the value at the specified indices
 *
 * Example:
 * accessNestedElements(listOf(listOf(listOf(1, 2), listOf(3, 4)), listOf(listOf(5, 6), listOf(7, 8))), listOf(1, 0, 1))
 * Output: 7
 */
fun accessNestedElements(data: Any, indices: List<Int>): Any {
/**
 * This function takes in a nested data structure and a list of
 * indices, and returns the value at the specified indices.
 *
 * @param data the nested data structure
 * @param indices the list of indices to access
 * @return the value at the specified indices
 *
 * Example:
 * accessNestedElements(listOf(listOf(listOf(1, 2), listOf(3, 4)), listOf(listOf(5, 6), listOf(7, 8))), listOf(1, 0, 1))
 * Output: 7
 */
fun accessNestedElements(data: Any, indices: List<Int>): Any {

    if (indices.isEmpty()) {
        return data
    } else {
        if (data is List<*>) {
            if (indices.size == 1) {
                return (data as List<Any>)[indices[0]]
            } else {
                return accessNestedElements((data as List<Any>)[indices[0]], indices.subList(1, indices.size))
            }
        } else {
            return data
        }
    }
}