using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static Scanner sc = new Scanner();
    static void Main(string[] args)
    {
        var N = sc.ReadInt();
        var A = sc.ReadIntArray(N);
        Array.Sort(A);

        var max = A[N - 1];
        var d = int.MinValue;
        var ans = 0;
        foreach (var x in A)
        {
            var y = Math.Min(max - x, x);
            if (d < y)
            {
                d = y;
                ans = x;
            }
        }

        Console.WriteLine($"{max} {ans}");
    }

    static int CountComb(int a, int b)
    {
        var modres = new Mod(0);
        var step = b - a;
        for (int s2 = 0; s2 < step / 2 + 1; s2++)
        {
            var s1 = step - s2 * 2;
            modres += Mod.Fac(s1 + s2) / Mod.Fac(s1) / Mod.Fac(s2);
        }
        return (int)modres;
    }


    static long Gcd(long a, long b)
    {
        var v = new[] { a, b };
        while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
        return v[0];
    }

    static long Lcm(long a, long b)
    {
        return a / Gcd(a, b) * b;
    }
}

class Mod
{
    private const int M = 1000000007;
    public long Value;
    public Mod(long value) { this.Value = value; }
    public static implicit operator Mod(long a)
    {
        var m = a % M;
        return new Mod((m < 0) ? m + M : m);
    }
    public static Mod operator +(Mod a, Mod b)
    {
        return a.Value + b.Value;
    }
    public static Mod operator -(Mod a, Mod b)
    {
        return a.Value - b.Value;
    }
    public static Mod operator *(Mod a, Mod b)
    {
        return a.Value * b.Value;
    }
    public static Mod Pow(Mod a, int n)
    {
        switch (n)
        {
            case 0:
                return 1;
            case 1:
                return a;
            default:
                var p = Pow(a, n / 2);
                return p * p * Pow(a, n % 2);
        }
    }
    public static Mod operator /(Mod a, Mod b)
    {
        return a * Pow(b, M - 2);
    }
    private static readonly List<int> facs = new List<int> { 1 };
    public static Mod Fac(int n)
    {
        for (int i = facs.Count; i <= n; ++i)
        {
            facs.Add((int)(Math.BigMul(facs.Last(), i) % M));
        }
        return facs[n];
    }
    public static Mod nCr(int n, int r)
    {
        return (n < r) ? 0
        : (n == r) ? 1
        : Fac(n) / (Fac(r) * Fac(n - r));
    }
    public static explicit operator int(Mod a)
    {
        return (int)a.Value;
    }
}

class Debug
{
    static void Dump<T>(T[,] array)
    {
        Console.WriteLine();
        var h = array.GetLength(0);
        var w = array.GetLength(1);

        for (int r = 0; r < h; r++)
        {
            for (int c = 0; c < w; c++)
            {
                Console.Write(array[r, c]);
                Console.Write(" ");
            }
            Console.WriteLine();
        }
        Console.WriteLine();
    }
}

class Scanner
{
    string[] S = new string[0];
    int Index = 0;
    char[] Separators = new char[] { ' ' };

    public string Next()
    {
        if (this.Index < this.S.Length) return this.S[this.Index++];
        var line = "";
        while (line == "") line = Console.ReadLine();
        this.S = line.Split(this.Separators, StringSplitOptions.RemoveEmptyEntries);
        if (this.S.Length == 0) return this.Next();
        this.Index = 0;
        return this.S[this.Index++];
    }

    public string ReadStr()
    {
        return this.Next();
    }

    public char ReadChar()
    {
        return this.Next()[0];
    }

    public int ReadInt()
    {
        return int.Parse(this.Next());
    }

    public uint ReadUInt()
    {
        return uint.Parse(this.Next());
    }

    public long ReadLong()
    {
        return long.Parse(this.Next());
    }

    public double ReadDouble()
    {
        return double.Parse(this.Next());
    }

    public int[] ReadIntArray(int n)
    {
        if (n == 0) return new int[] { };
        var array = new int[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadInt();
        }
        return array;
    }

    public long[] ReadLongArray(int n)
    {
        if (n == 0) return new long[] { };
        var array = new long[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadLong();
        }
        return array;
    }

    public double[] ReadDoubleArray(int n)
    {
        if (n == 0) return new double[] { };
        var array = new double[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadDouble();
        }
        return array;
    }

    public char[] ReadCharArray(int n)
    {
        if (n == 0) return new char[] { };
        var array = new char[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadChar();
        }
        return array;
    }

    public string[] ReadStrArray(int n)
    {
        if (n == 0) return new string[] { };
        var array = new string[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadStr();
        }
        return array;
    }
}

class HashMap<K, V> : Dictionary<K, V> where V : new()
{
    private V DefaltValue = new V();
    public HashMap() { }
    public HashMap(V defaultValue)
    {
        this.DefaltValue = new V();
    }
    new public V this[K i]
    {
        get
        {
            V v;
            return TryGetValue(i, out v) ? v : base[i] = this.DefaltValue;
        }
        set { base[i] = value; }
    }
}


Measured memory_bytes: 24416