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


namespace debug
{
    class Program
    {
        static void Main(string[] args)
        {
            ProgramD a = new ProgramD();
            a.main();

        }
    }

    //ABC094
    class ProgramA
    {
        public void main()
        {
            string[] s = Console.ReadLine().Split(' ');
            int a = int.Parse(s[0]);
            int b = int.Parse(s[1]);
            int x = int.Parse(s[2]);

            if(a <= x && x <= a + b)
                Console.WriteLine("YES");
            else
                Console.WriteLine("NO");
        }
    }

    class ProgramB
    {
        public void main()
        {
            string[] s = Console.ReadLine().Split(' ');
            int n = int.Parse(s[0]);
            int m = int.Parse(s[1]);
            int x = int.Parse(s[2]);
            string[] xi = Console.ReadLine().Split(' ');

            int count0 = 0;
            int countn = 0;

            for (int i = 0; i < m; i++)
            {
                if (int.Parse(xi[i]) == x)
                    continue;
                if (int.Parse(xi[i]) < x)
                    count0++;
                else
                    countn++;
            }

            Console.WriteLine(Math.Min(count0,countn));
            

        }
    }

    class ProgramC
    {
        public void main()
        {
            long n = long.Parse(Console.ReadLine());
            string[] xi = Console.ReadLine().Split(' ');

            long[] a = new long[n];

            for (int i = 0; i < n; i++)
                a[i] = long.Parse(xi[i]);

            //ソートする
            Array.Sort(a);

            //
            for (int i = 0; i < n; i++)
            {
                if (a[n / 2 - 1] >= long.Parse(xi[i]))
                    Console.WriteLine(a[n / 2]);
                else
                    Console.WriteLine(a[n / 2 - 1]);
            }
            
            

        }
    }

    class ProgramD
    {
        public void main()
        {
            long n = long.Parse(Console.ReadLine());
            string[] xi = Console.ReadLine().Split(' ');

            long[] a = new long[n];

            for (int i = 0; i < n; i++)
                a[i] = long.Parse(xi[i]);

            //ソートする
            Array.Sort(a);

            //最大値候補
            long sum = a[n - 1] / 2;

            //二分探索
            long min = -1;
            long max = n;
            while(min + 1 != max)
            {
                long temp = (min + max) / 2;
                if (a[temp] <= sum)
                    min = temp;
                else
                    max = temp;
            }

            if(min == -1)
            {
                Console.WriteLine(a[n - 1] + " " + a[0]);
                return;
            }

            if (min == n - 2)
            {
                Console.WriteLine(a[n - 1] + " " + a[n - 2]);
                return;
            }

            if (sum - a[min] < a[max] - sum)
                Console.WriteLine(a[n - 1] + " " + a[min]);
            else
                Console.WriteLine(a[n - 1] + " " + a[max]);

        }

    }

    

}


Measured memory_bytes: 37656