// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;

inline int toInt(string s) { int v; istringstream in(s); in >> v; return v; }
template<class T> inline string toString(T x) { ostringstream out; out << x; return out.str(); }

template<class T> inline T sqr(T x) { return x * x; }
const int INF = (1 << 25);
const double EPS = 1e-10;
const double PI  = acos(-1.0);

#define CLR(a) memset((a), 0, sizeof(a))

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define ALL(a)  (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(),(c).end())

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n)  FOR(i, 0, n)

#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main() {
    int n;
    scanf("%d", &n);
    vi a(n);
    REP(i, n) scanf("%d", &a[i]);
    SORT(a);

    if (n == 2) {
        printf("%d %d\n", a[1], a[0]);
    }
    else {
        int x = a[n - 1];
        int l = 0;
        int r = n - 2;
        int y = -1;
        while (l <= r) {
            int m = l + (r - l) / 2;
            if (a[m] * 2 == x) {
                y = a[m];
                break;
            }
            else if (a[m] * 2 > x) r = m - 1;
            else l = m + 1;
        }
        if (y == -1) y = abs(a[l] * 2 - x) > abs(a[r] * 2 - x) ? a[r] : a[l];
        printf("%d %d\n", x, y);
    }
    return 0;
}


Measured memory_bytes: 640