#include <iostream>
#include <algorithm>
using namespace std;
#define MAXN 100000
int map[MAXN];
int N;
pair<int,int> b_search(int idx, int target) {
int low = idx + 1;
int high = N - 1;
pair<int, int> ans = { 0,2e9 };
while (low <= high) {
int mid = (low + high) / 2;
if (map[mid] + target > 0) {
high = mid - 1;
}
else if (map[mid] + target < 0) {
low = mid + 1;
}
else return { mid,0 };
if (ans.second > abs(map[mid] + target)) {
ans.first = mid;
ans.second = abs(map[mid] + target);
}
}
return ans;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> N;
int ans = 2e9;
pair<int,int> idx = { 0,0};
for (int i = 0; i < N; i++) {
cin >> map[i];
}
for (int i = 0; i < N - 1; i++) {
pair<int,int> sum = b_search(i, map[i]);
if (ans > sum.second) {
ans = sum.second;
idx = { i,sum.first };
}
}
printf("%d %d", map[idx.first], map[idx.second]);
return 0;
}