/**
 * Given a list of historical events represented as nested tuples, add the specified year to the event specified by its name.
 *
 * @param events A list of historical events represented as nested tuples.
 * @param event_name The name of the event to add the year to.
 * @param year The year to be added to the event.
 * @return The updated list of historical events with the year added to the specified event.
 */
fun addYearToEvent(events: MutableList<Triple<String, String, Int>>, event_name: String, year: Int): MutableList<Triple<String, String, Int>> {

    for (event in events.withIndex()) {
        if (event.value.first == event_name) {
            events[event.index] = Triple(event.value.first, event.value.second, year)
            return events
        }
    }
    events.add(Triple(event_name, "", year))
    return events
}
/**
 * Given a list of historical events represented as nested tuples, add the specified year to the event specified by its name.
 *
 * @param events A list of historical events represented as nested tuples.
 * @param event_name The name of the event to add the year to.
 * @param year The year to be added to the event.
 * @return The updated list of historical events with the year added to the specified event.
 */
fun addYearToEvent(events: MutableList<Triple<String, String, Int>>, event_name: String, year: Int): MutableList<Triple<String, String, Int>> {
/**
 * Given a list of historical events represented as nested tuples, add the specified year to the event specified by its name.
 *
 * @param events A list of historical events represented as nested tuples.
 * @param event_name The name of the event to add the year to.
 * @param year The year to be added to the event.
 * @return The updated list of historical events with the year added to the specified event.
 */
fun addYearToEvent(events: MutableList<Triple<String, String, Int>>, event_name: String, year: Int): MutableList<Triple<String, String, Int>> {

    for (event in events.withIndex()) {
        if (event.value.first == event_name) {
            events[event.index] = Triple(event.value.first, event.value.second, year)
            return events
        }
    }
    events.add(Triple(event_name, "", year))
    return events
}