/**
 * Given the ranges a1-a2, b1-b2, and c1-c2, this function finds the intersection range between all three ranges,
 * including negative values.
 *
 * @param a1 the starting value of the first range
 * @param a2 the ending value of the first range
 * @param b1 the starting value of the second range
 * @param b2 the ending value of the second range
 * @param c1 the starting value of the third range
 * @param c2 the ending value of the third range
 * @return The intersection range between a1-a2, b1-b2, and c1-c2
 *
 * Example:
 * findIntersection(-5, 5, -10, 0, -3, 8) returns Pair(-3, 0)
 */
fun findIntersection(a1: Int, a2: Int, b1: Int, b2: Int, c1: Int, c2: Int): Pair<Int, Int> {

    val start = maxOf(a1, b1, c1)
    val end = minOf(a2, b2, c2)
    return Pair(start, end)
}
/**
 * Given the ranges a1-a2, b1-b2, and c1-c2, this function finds the intersection range between all three ranges,
 * including negative values.
 *
 * @param a1 the starting value of the first range
 * @param a2 the ending value of the first range
 * @param b1 the starting value of the second range
 * @param b2 the ending value of the second range
 * @param c1 the starting value of the third range
 * @param c2 the ending value of the third range
 * @return The intersection range between a1-a2, b1-b2, and c1-c2
 *
 * Example:
 * findIntersection(-5, 5, -10, 0, -3, 8) returns Pair(-3, 0)
 */
fun findIntersection(a1: Int, a2: Int, b1: Int, b2: Int, c1: Int, c2: Int): Pair<Int, Int> {
/**
 * Given the ranges a1-a2, b1-b2, and c1-c2, this function finds the intersection range between all three ranges,
 * including negative values.
 *
 * @param a1 the starting value of the first range
 * @param a2 the ending value of the first range
 * @param b1 the starting value of the second range
 * @param b2 the ending value of the second range
 * @param c1 the starting value of the third range
 * @param c2 the ending value of the third range
 * @return The intersection range between a1-a2, b1-b2, and c1-c2
 *
 * Example:
 * findIntersection(-5, 5, -10, 0, -3, 8) returns Pair(-3, 0)
 */
fun findIntersection(a1: Int, a2: Int, b1: Int, b2: Int, c1: Int, c2: Int): Pair<Int, Int> {

    val start = maxOf(a1, b1, c1)
    val end = minOf(a2, b2, c2)
    return Pair(start, end)
}