import java.io.{BufferedOutputStream, BufferedReader, InputStreamReader, PrintWriter}

import scala.annotation.tailrec

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val out = new PrintWriter(new BufferedOutputStream(System.out))
    val n = in.readLine().toInt
    val as = in.readLine().split("\\s+").map(_.toInt).sorted

    @tailrec
    def binarySearch(left: Int, right: Int, value: Int): Int = {
      if (left + 1 == right) {
        left
      } else {
        val center = (left + right) / 2
        if (as(center) <= value) {
          binarySearch(center, right, value)
        } else {
          binarySearch(left, center, value)
        }
      }
    }

    val max_a = as.last

    val r = as({
      val m = binarySearch(0, n - 1, max_a / 2)
      if (m == n - 2) {
        m
      } else {
        if (max_a / 2 - as(m) < as(m + 1) - max_a / 2) {
          m
        } else {
          m + 1
        }
      }
    })

    out.println(List(max_a, r).mkString(" "))
    out.flush()
  }
}
