using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace pokusaj
{
    class Program
    {
        
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] brojevi;
            int n1 = 0;
            int n2 = 0;
            int brojac = 0;
            brojevi = Console.ReadLine().Split();
            for (int i = 0; i < n; i++)
            {
                int x = int.Parse(brojevi[i]);
                brojac++;
                if (brojac == 1)
                {
                    n1 = x;
                }
                else if (brojac == 2)
                {
                    n2 = x;
                }
            }
            if (n1 >= n2)
                Console.WriteLine(n1 + " " + n2);
            else
                Console.WriteLine(n2 + " " + n1);
        }
    }
}