fun main(args: Array<String>) {
    arc095b()
}

fun arc095b() {
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map { it.toLong() }.toMutableList()

    val max = a.max()!!
    a.remove(max)
    val mid = a.minBy { Math.abs(it * 2 - max) }!!

    val answer = "$max $mid"

    println(answer)
}

