fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map { it.toInt() }.toMutableList()
    a.sort()
    val i = a.last()

    var minDis = Int.MAX_VALUE
    var result = 0
    a.removeAt(a.size - 1)
    a.forEach {
        if (Math.abs(it - i / 2) <= minDis) {
            minDis = Math.abs(it - i / 2)
            result = it
        }
    }
    print(i)
    print(' ')
    print(result)
}