#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> a[1001];
int main() {
  int n, ai;
  cin >> n;
  for (int i = (0); i < (n); ++i) {
    cin >> ai;
    a[i] = {ai % (n - 1), ai};
  }
  sort(a, a + n);
  for (int i = (1); i < (n); ++i) {
    if (a[i].first == a[i + 1].first) {
      cout << a[i].second << " " << a[i + 1].second << endl;
      return 0;
    }
  }
  return 0;
}
