/**
 * Extinguishes the fire at the given location using a branching statement and a for loop.
 */
fun extinguishFire(fireLocation: Triple<Int, Int, Int>) {

    // Retrieve the coordinates of the fire location
    val (x, y, z) = fireLocation

    // Assume that the firefighter is initially far away from the fire
    var firefighterX = 0
    var firefighterY = 0
    var firefighterZ = 0

    // Use a branching statement to determine the optimal direction for the firefighter to reach the fire
    val directionX = if (x < firefighterX) "west" else "east"
    val directionY = if (y < firefighterY) "south" else "north"
    val directionZ = if (z < firefighterZ) "down" else "up"

    // Use a for loop to move the firefighter towards the fire one unit at a time
    repeat(Math.abs(x - firefighterX)) {
        firefighterX++
        println("Moving $directionX")
    }

    repeat(Math.abs(y - firefighterY)) {
        firefighterY++
        println("Moving $directionY")
    }

    repeat(Math.abs(z - firefighterZ)) {
        firefighterZ++
        println("Moving $directionZ")
    }
}
/**
 * Extinguishes the fire at the given location using a branching statement and a for loop.
 */
fun extinguishFire(fireLocation: Triple<Int, Int, Int>) {
/**
 * Extinguishes the fire at the given location using a branching statement and a for loop.
 */
fun extinguishFire(fireLocation: Triple<Int, Int, Int>) {

    // Retrieve the coordinates of the fire location
    val (x, y, z) = fireLocation

    // Assume that the firefighter is initially far away from the fire
    var firefighterX = 0
    var firefighterY = 0
    var firefighterZ = 0

    // Use a branching statement to determine the optimal direction for the firefighter to reach the fire
    val directionX = if (x < firefighterX) "west" else "east"
    val directionY = if (y < firefighterY) "south" else "north"
    val directionZ = if (z < firefighterZ) "down" else "up"

    // Use a for loop to move the firefighter towards the fire one unit at a time
    repeat(Math.abs(x - firefighterX)) {
        firefighterX++
        println("Moving $directionX")
    }

    repeat(Math.abs(y - firefighterY)) {
        firefighterY++
        println("Moving $directionY")
    }

    repeat(Math.abs(z - firefighterZ)) {
        firefighterZ++
        println("Moving $directionZ")
    }
}