fun main(args:Array<String>):Unit {
    while (true) {
        val n = readLine()!!.toInt()
        if (n == 0) return
        val scores = Array(n) { readLine()!!.split(' ').map(String::toInt).sum() }
        println("${scores.max()} ${scores.min()}")
    }
}
