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

int main() {
  int n;
  cin >> n;
  vector<int> num(n);
  for (int i = 0; i < n; i++) cin >> num[i];
  sort(num.begin(), num.end());
  int half = num[n-1]/2;
  int ans = 1000000000;
  for (int i = 0; i < n-1; i++) {
    if (abs(half - num[i]) <= abs(half - ans)) ans = num[i];
  }
  cout << num[n-1] << " " << ans << endl;
}
