/**
 * Given a list of coordinates and a list of items, find the item that is closest to the origin (0, 0).
 *
 * @param coordinates A list of tuples representing coordinates in the format (x, y).
 * @param items A list of corresponding items for each coordinate.
 * @return The item that is closest to the origin.
 *
 * Example:
 * findClosestItem(listOf(Pair(1, 2), Pair(-3, 4), Pair(5, -6)), listOf("chair", "table", "lamp")) // Output: "table"
 */
fun findClosestItem(coordinates: List<Pair<Int, Int>>, items: List<String>): String {

    var closestDistance = Int.MAX_VALUE
    var closestItem: String? = null
    for (i in coordinates.indices) {
        val coordinate = coordinates[i]
        val distance = Math.abs(coordinate.first) + Math.abs(coordinate.second)
        if (distance < closestDistance) {
            closestDistance = distance
            closestItem = items[i]
        }
    }
    return closestItem ?: ""
}
/**
 * Given a list of coordinates and a list of items, find the item that is closest to the origin (0, 0).
 *
 * @param coordinates A list of tuples representing coordinates in the format (x, y).
 * @param items A list of corresponding items for each coordinate.
 * @return The item that is closest to the origin.
 *
 * Example:
 * findClosestItem(listOf(Pair(1, 2), Pair(-3, 4), Pair(5, -6)), listOf("chair", "table", "lamp")) // Output: "table"
 */
fun findClosestItem(coordinates: List<Pair<Int, Int>>, items: List<String>): String {
/**
 * Given a list of coordinates and a list of items, find the item that is closest to the origin (0, 0).
 *
 * @param coordinates A list of tuples representing coordinates in the format (x, y).
 * @param items A list of corresponding items for each coordinate.
 * @return The item that is closest to the origin.
 *
 * Example:
 * findClosestItem(listOf(Pair(1, 2), Pair(-3, 4), Pair(5, -6)), listOf("chair", "table", "lamp")) // Output: "table"
 */
fun findClosestItem(coordinates: List<Pair<Int, Int>>, items: List<String>): String {

    var closestDistance = Int.MAX_VALUE
    var closestItem: String? = null
    for (i in coordinates.indices) {
        val coordinate = coordinates[i]
        val distance = Math.abs(coordinate.first) + Math.abs(coordinate.second)
        if (distance < closestDistance) {
            closestDistance = distance
            closestItem = items[i]
        }
    }
    return closestItem ?: ""
}