#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
  int i,N,a[200001],M,h,m=2000000000,val;
  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&a[i]);
  }
  sort(a,a+N);
  M = a[N-1];
  if(!(M%2))
    h = M/2;
  else
    h = M/2 + 1;
  for(i=0;i<N;i++)
    if(abs(h - a[i]) < m){
      m = abs(h - a[i]);
      val = a[i];
    }
  printf("%d %d\n",M,val);
}
