#include<stdio.h>
int main(void){
  char *s="python3 -c\""
"n=int(input())\n"
"a=list(map(int,input().split()))\n"
"b=max(a)\n"
"c=b\n"
"d=0\n"
"for i in a:\n"
"  if c>=abs(b/2-i):c=abs(b/2-i);d=i\n"
"print(b,d)\n"
"\"";
  system(s);
  return 0;
}            