

fun main(args:Array<String>):Unit {
    repeat(readLine()!!.toInt()){
        val n = readLine()!!.toInt()
        val blocks = readLine()!!.split(' ').map(String::toInt).toIntArray()
        var maxUp = 0
        var minDown = 0
        for (i in 1 until n){
            if (maxUp < blocks[i] - blocks[i - 1])
                maxUp = blocks[i] - blocks[i - 1]
            if (minDown > blocks[i] - blocks[i - 1])
                minDown = blocks[i] - blocks[i - 1]
        }
        println("${maxUp} ${-minDown}")
    }
}
