#include<bits/stdc++.h>
using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0; i<n; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  int ans1 = a[n-1], ans2, m = 1e9;
  for(int i = 0; i<n; i++) {
    if (m > abs(ans1 - a[i] * 2)) {
      m = abs(ans1 - a[i] * 2);
      ans2 = a[i];
    }
  }
  cout << ans1 << " " << ans2;
}