import java.util.Scanner

import scala.util.Sorting

object Main {
  def solve(a: Array[Int]) = {
    Sorting.quickSort(a)
    val n = a.last
    val mid = n / 2
    val p = lowerBound(a, mid)
    val p2 = math.max(0, p - 1)
    val r =
      if (a(p) == n) a(p2)
      else if (a(p2) == n) a(p)
      else if (math.abs(2 * a(p) - n) > math.abs(2 * a(p2) - n)) a(p2) else a(p)
    (n, r)
  }

  def lowerBound(as: Array[Int], x: Int): Int = {
    def step(l: Int, h: Int): Int = h - l match {
      case 1 => h
      case _ =>
        val mid = l + (h - l) / 2
        if (as(mid) > x) {
          step(l, mid)
        } else {
          step(mid, h)
        }
    }
    step(-1, as.length)
  }

  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val N = sc.nextInt()
    val as = Array.fill(N)(sc.nextInt())
    val (n, r) = solve(as)
    println(s"$n $r")
  }
}
