fun main(args : Array<String>) {
  readLine()
  readLine()!!.split(" ").map { it.toInt() }.apply {
    val mid = max()!! / 2
    var dif = Int.MAX_VALUE
    sorted().forEach {
      if (it >= mid) {
        print(if (it - mid > dif || it == max()) "${max()} ${mid - dif}" else "${max()} $it")
        return
      } else if (mid - it < dif) dif = mid - it
    }
  }
}