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

namespace Codeforces
{
    class _1108B
    {
        public static void Delete(int[] a, int v)
        {
            for(int i = 0; i < a.Length; i++)
            {
                if(a[i] == v)
                {
                    a[i] = 0;
                    break;
                }
            }
        }

        public static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = new int[n];
            int max = 0;
            string[] ss = Console.ReadLine().Split();
            for (int i = 0; i < n; i++)
            {
                int m = int.Parse(ss[i]);
                a[i] = m;
                if (a[i] > max)
                {
                    max = a[i];
                }
            }
            Console.Write(max);
            Console.Write(" ");
            for (int i = 1; i <= max; i++)
            {
                if (max % i == 0)
                {
                    Delete(a, i);
                }
            }
            max = 0;
            for(int i = 0; i < n; i++)
            {
                if (a[i] > max)
                    max = a[i];
            }
            Console.WriteLine(max);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.CodeForces._535
{
    class B
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            var list = new List<int>();
            list.AddRange(ReadInts());
            list.Sort();
            list.Reverse();
            int max = list[0];
            list.RemoveAt(0);
            int now = max;
            for (int i = 0; i < list.Count; i++)
            {
                if (now != list[i]
                    && max % list[i] == 0)
                {
                    now = list[i];
                    list.RemoveAt(i);
                    i--;
                }
            }
            Console.WriteLine(max + " " + list[0]);
        }

        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read(), System.Globalization.CultureInfo.InvariantCulture); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), i => Convert.ToDouble(i, System.Globalization.CultureInfo.InvariantCulture)); }
    }
}

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;

namespace a
{
    class Program
    {
        static void Solve()
        {
            var n = int.Parse(Console.ReadLine());
            var l = Console.ReadLine().Split().Select(int.Parse).ToList();
            var t = l.ToList();
            l = l.Distinct().ToList();
            var r1 = l.Max();
            var r2 = 0;
            for (int i = 0; i < l.Count(); i++)
            {
                if (r1 % l[i] == 0)
                {
                    t.Remove(l[i]);
                }
            }
            r2 = t.Max();
            Console.WriteLine(r1 + " " + r2);
        }

        static void Main(string[] args)
        {
#if DEBUG
            var fin = new StreamReader(new FileStream("input.txt", FileMode.Open));
            var fout = new StreamWriter(new FileStream("output.txt", FileMode.Create));
            Console.SetIn(fin);
            Console.SetOut(fout);
#endif
            Solve();
#if DEBUG
            fin.Close();
            fout.Close();
#endif
        }
    }
}

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

namespace a
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var l = Console.ReadLine().Split().Select(int.Parse).ToList();
            var t = l.ToList();
            l = l.Distinct().ToList();
            var r1 = l.Max();
            var r2 = 0;
            for (int i = 0; i < l.Count(); i++)
            {
                if (r1 % l[i] == 0)
                {
                    t.Remove(l[i]);
                }
            }
            r2 = t.Max();
            Console.WriteLine(r1 + " " + r2);
            //Console.ReadKey();
        }
    }
}

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

namespace CSharp
{
    class _1108B
    {
        public static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            var d = new SortedDictionary<int, int>(Console.ReadLine().Split().Select(token => int.Parse(token)).GroupBy(i => i).ToDictionary(g => g.Key, g => g.Count()));

            int x = d.Last().Key;
            for (int i = 1; i <= x; i++)
            {
                if (x % i == 0)
                {
                    d[i]--;
                }
            }

            int y = d.Last(kvp => kvp.Value > 0).Key;

            Console.WriteLine($"{x} {y}");
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using CompLib.Util;

public class Program
{

    public void Solve()
    {
        var sc = new Scanner();
        int n = sc.NextInt();
        int[] a = sc.IntArray();

        /*
         * x,y
         *
         * xの約数のリスト、
         * yの約数のリスト
         */
        var ls = a.ToList();
        var max = a.Max();
        for (int i = 1; i * i <= max; i++)
        {
            if (max % i == 0)
            {
                ls.Remove(i);
                int j = max / i;
                if (i != j) ls.Remove(j);
            }
        }

        Console.WriteLine($"{max} {ls.Max()}");
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            if (_index >= _line.Length)
            {
                string s;
                do
                {
                    s = Console.ReadLine();
                } while (s.Length == 0);

                _line = s.Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public string ReadLine()
        {
            _index = _line.Length;
            return Console.ReadLine();
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            string s = Console.ReadLine();
            _line = s.Length == 0 ? new string[0] : s.Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CompLib.Util;

public class Program
{

    public void Solve()
    {
        var sc = new Scanner();
        int n = sc.NextInt();
        int[] d = sc.IntArray();

        // x,yを受け取った
        // xの約数、yの約数列挙、シャッフル　...d

        // x,yいくつか?
        Array.Sort(d);
        int x = d[n - 1];
        var divX = new HashSet<int>();
        for (int i = 1; i * i <= x; i++)
        {
            if (x % i == 0)
            {
                if (x / i != i) divX.Add(x / i);
                divX.Add(i);
            }
        }
        var divY = new HashSet<int>();
        foreach (int i in d)
        {
            if (divX.Contains(i))
            {
                divX.Remove(i);
            }
            else
            {
                divY.Add(i);
            }
        }

        Console.WriteLine($"{x} {divY.Max()}");
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

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

public class GFG
{
    static public void Main()
    {
        try
        {
            // int test = Convert.ToInt32(Console.ReadLine());
            // for (int i = 0; i < test; i++)

            {
                // var input = Console.ReadLine().Split(' ');
                var n = Int32.Parse(Console.ReadLine());
                //var a = int.Parse(input[0]);
                //var b = int.Parse(input[1]);
                //var c = int.Parse(input[2]);
                //var d = int.Parse(input[3]);
                //  var str = Console.ReadLine();

                //var arr1 = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
                //var arr2 = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();

                List<int> lst = new List<int>();
                string[] input = Console.ReadLine().Split(' ');

                for (int i = 0; i < n; i++)
                {
                    lst.Add(Int32.Parse(input[i]));
                }

                DistictPoint(lst);
                Console.WriteLine();
            }
        }
        catch (Exception ex)
        {
            Console.Write(ex);
        }
    }
    static void DistictPoint(List<int> div)
    {

        int max = div.Max();

        for (int i = 1; i <= max; i++)
        {
            if (max % i == 0)
                div.Remove(i);
        }

        Console.Write(max + " " + div.Max());

    }

}

using System;
using System.Collections.Generic;
using System.Dynamic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;

namespace ConsoleApp1
{
	class Program
	{
		static void Main(string[] args)
		{
			//int n = ConsoleLine.Read();
			//string str = ConsoleLine.Read();

			//char[] pattern = new[] {'R', 'G', 'B'};

			//int[] r = new int[3];
			//for (int i = 0; i < str.Length; i++)
			//{
			//	if (str[i] != pattern[i % 3]) r[0]++;
			//	if (str[i] != pattern[(i + 1) % 3]) r[1]++;
			//	if (str[i] != pattern[(i + 2) % 3]) r[2]++;
			//}

			//int index;
			//if (r[0] <= r[1] && r[0] <= r[2])
			//{
			//	index = 0;
			//} else if (r[1] <= r[0] && r[1] <= r[2])
			//{
			//	index = 1;
			//}
			//else
			//{
			//	index = 2;
			//}

			//Console.WriteLine(r[index]);
			//Console.WriteLine(new string(Enumerable.Range(0, n).Select(i => pattern[(i + index) % 3]).ToArray()));

			int n = ConsoleLine.Read();
			int[] items = ConsoleLine.Read();

			HashSet<int> div1 = new HashSet<int>();
			HashSet<int> div2 = new HashSet<int>();

			int a = items.Max();
			foreach (var item in items)
			{
				if (a % item == 0 && !div1.Contains(item))
				{
					div1.Add(item);
				}
				else
				{
					div2.Add(item);
				}
			}

			Console.WriteLine($"{div1.Max()} {div2.Max()}");
		}
	}

	public class ConsoleLine
	{
		private readonly string _line;

		public ConsoleLine(string line)
		{
			_line = line;
		}

		public void ToIntArray(out int[] arr)
		{
			arr = _line.Split(' ').Select(int.Parse).ToArray();
		}

		public static implicit operator string(ConsoleLine line)
		{
			return line._line;
		}

		public static implicit operator int(ConsoleLine line)
		{
			return int.Parse(line._line);
		}

		public static implicit operator int[](ConsoleLine line)
		{
			line.ToIntArray(out int[] arr);
			return arr;
		}

		public static ConsoleLine Read()
		{
			string line = Console.ReadLine();
			return line == null
				? null
				: new ConsoleLine(line);
		}
	}
}

using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;
class Z { static void Main() => new K(); }
class K
{
	int F => int.Parse(Str);
	long FL => long.Parse(Str);
	int[] G => Strs.Select(int.Parse).ToArray();
	long[] GL => Strs.Select(long.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
	const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		var n = F;
		var d = G.ToList();
		var x = d.Max();
		foreach (var a in Divisors(x)) d.Remove(a);
		var y = d.Max();
		WriteLine($"{x} {y}");
	}
	IEnumerable<int> Divisors(int n)
	{
		for (var i = 1; i <= n; i++) if (n % i == 0) yield return i;
	}
}

using System;
using System.Collections.Generic;

namespace _1108B_Divisors_of_Two_Integers
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Int32.Parse(Console.ReadLine());
            string [] numbers = Console.ReadLine().Split();
            var divisors1 = new SortedSet<int>();
            var divisors2 = new SortedSet<int>();

            for (int i = 0; i < n; i++)
            {
                if (divisors1.Contains(Int32.Parse(numbers[i])))
                {
                    divisors2.Add(Int32.Parse(numbers[i]));
                }
                else
                {
                    divisors1.Add(Int32.Parse(numbers[i]));
                }
            }

            int x, y = 0;
            x = divisors1.Max;
            var toRemove = new List<int>();

            foreach (var item in divisors1)
            {
                double division = (double)x/(double)item;

                if (division % 1 == 0)
                {
                    toRemove.Add(x/item);
                }
            }

            foreach (var item in toRemove)
            {
                divisors1.Remove(item);
            }

            if (divisors1.Count == 0)
            {
                y = divisors2.Max;
            }
            else
            {
                y = Math.Max(divisors1.Max, divisors2.Max);
            }

            Console.WriteLine(x + " " + y);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Text;

namespace codeforces
{

    class Program
    {
        const int N = 128;
        const int M = 10001;

        static int[] a = new int[N];
        static int[] cnt = new int[M];
        static int[] cntTemp = new int[M];

        static void calc(int x)
        {
            for (int i = 1; i * i <= x; ++i)
            {
                if (x % i == 0)
                {
                    cntTemp[i]++;
                    if (i != x / i)
                    {
                        cntTemp[x / i]++;
                    }
                }
            }
        }

        static bool check(int n, int x, int y)
        {
            for (int i = 0; i < n; ++i)
            {
                cntTemp[a[i]] = 0;
            }
            calc(x);
            calc(y);
            for (int i = 0; i < n; ++i)
            {
                if (cnt[a[i]] != cntTemp[a[i]])
                {
                    return false;
                }
            }
            return true;
        }

        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            var s = Console.ReadLine().Split(' ');
            int fIndex = 0;
            for (int i = 0; i < n; ++i)
            {
                a[i] = int.Parse(s[i]);
                if (a[fIndex] < a[i])
                {
                    fIndex = i;
                }
                cnt[a[i]]++;
            }
            for (int i = 0; i < n; ++i)
            {
                if (i != fIndex && check(n, a[fIndex], a[i]))
                {
                    Console.Write(a[fIndex] + " " + a[i]);
                    break;
                }
            }
            Console.Read();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;

namespace Olymp
{
  public class ProblemSolver
  {
    private Tokenizer input;

    public void Solve()
    {
      var n = input.ReadInt();
      int m = 10001;
      var d = input.ReadIntArray(n);
      var c = new int[m];
      for (var i = 0; i < n; i++)
      {
        c[d[i]]++;
      }
      var a = d.Max();
      var b = 1;
      if (c[a] > 1)
        b = a;
      else
      {
        for (var i = 1; i < m; i++)
        {
          if (a % i == 0)
            c[i]--;
        }
        for (var i = 1; i < m; i++)
        {
          if (c[i] == 1)
            b = i;
        }
      }
      Console.Write(a + " " + b);
    }

    public ProblemSolver(TextReader input)
    {
      this.input = new Tokenizer(input);
    }

    #region Service functions

    private static void AddCount<T>(Dictionary<T, int> counter, T item)
    {
      if (counter.TryGetValue(item, out var count))
        counter[item] = count + 1;
      else
        counter.Add(item, 1);
    }

    private static int GetCount<T>(Dictionary<T, int> counter, T item)
    {
      return counter.TryGetValue(item, out var count) ? count : 0;
    }

    private static int GCD(int a, int b)
    {
      while (b != 0)
      {
        a %= b;
        var t = b;
        b = a;
        a = t;
      }
      return a;
    }

    #endregion
  }

  #region Service classes

  public class Tokenizer
  {
    private TextReader reader;

    public string ReadToEnd()
    {
      return this.reader.ReadToEnd();
    }

    public int ReadInt()
    {
      var c = SkipWS();
      if (c == -1)
        throw new EndOfStreamException();
      var isNegative = false;
      if (c == '-' || c == '+')
      {
        isNegative = c == '-';
        c = this.reader.Read();
        if (c == -1)
          throw new InvalidOperationException();
      }
      if (!char.IsDigit((char)c))
        throw new InvalidOperationException();
      var result = (char)c - '0';
      c = this.reader.Read();
      while (c > 0 && !char.IsWhiteSpace((char)c))
      {
        if (!char.IsDigit((char)c))
          throw new InvalidOperationException();
        result = result * 10 + (char)c - '0';
        c = this.reader.Read();
      }
      if (isNegative)
        result = -result;
      return result;
    }

    public string ReadLine()
    {
      return reader.ReadLine();
    }

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

    public double ReadDouble()
    {
      return double.Parse(this.ReadToken(), CultureInfo.InvariantCulture);
    }

    public int[] ReadIntArray(int n)
    {
      var a = new int[n];
      for (var i = 0; i < n; i++)
        a[i] = ReadInt();
      return a;
    }

    public long[] ReadLongArray(int n)
    {
      var a = new long[n];
      for (var i = 0; i < n; i++)
        a[i] = ReadLong();
      return a;
    }

    public double[] ReadDoubleArray(int n)
    {
      var a = new double[n];
      for (var i = 0; i < n; i++)
        a[i] = ReadDouble();
      return a;
    }

    public string ReadToken()
    {
      var c = SkipWS();
      if (c == -1)
        return null;
      var sb = new StringBuilder();
      while (c > 0 && !char.IsWhiteSpace((char)c))
      {
        sb.Append((char)c);
        c = this.reader.Read();
      }
      return sb.ToString();
    }

    private int SkipWS()
    {
      var c = this.reader.Read();
      if (c == -1)
        return c;
      while (c > 0 && char.IsWhiteSpace((char)c))
        c = this.reader.Read();
      return c;
    }

    public Tokenizer(TextReader reader)
    {
      this.reader = reader;
    }
  }

  internal class Program
  {
    public static void Main(string[] args)
    {
      var solver = new ProblemSolver(Console.In);
      solver.Solve();
    }
  }

  #endregion
}

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

namespace делители_двух_чисел
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var y = 0;
            var numbers = new int[int.Parse(Console.ReadLine())];
            var input = Console.ReadLine().Split();
            for (var i = 0; i < numbers.Length; i++)
            {
                numbers[i] = int.Parse(input[i]);
                if (numbers[i] > y)
                    y = numbers[i];
            }
            var dividersY =  new List<int>();
            GetDividers(y, dividersY);
            var dividersX = numbers.ToList();
            for(var i = 0; i < dividersY.Count; i++)
            {
                dividersX.Remove(dividersY[i]);
            }
            dividersX.Sort();
            var x = dividersX[dividersX.Count-1];
            Console.WriteLine(x + " " + y);
        }

        public static void GetDividers(int number, List<int> dividers)
        {
            var n = 1;
            while (n<=number)
            {
                if (number%n==0)
                    dividers.Add(n);
                n++;
            }
        }
    }
}

using System;
using System.Numerics;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Text.RegularExpressions;

namespace ProjectEuler
{
    class Program
    {

        private static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            var divisors = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
            divisors.Sort();

            int x = divisors[n - 1];
            int y;
            int gdc = 1;
            List<int> divisor1 = new List<int>();

            for (int j = 0; j < n; j++)
            {
                divisor1.Add(divisors[j]);
            }

            for (int i = 0; i < n-1; i++)
            {

                if (divisor1[i] == divisor1[i+1])
                {
                    gdc = divisor1[i];
                }
                int tmp = divisor1[i];
                if (x%divisor1[i] == 0)
                {
                    divisors.Remove(tmp);
                }
            }

            divisors.Remove(x);
            if (divisors.Count == 0)
            {
                y = gdc;
            }
            else
            {
                y = divisors.Max();

            }
            Console.WriteLine($"{x} {y}");
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Runtime.CompilerServices;
using System.Text;
using System.Diagnostics;
using System.Numerics;
using static System.Console;
using static System.Convert;
using static System.Math;
using static Template;
using Pi = Pair<int, int>;

class Solver
{
    public void Solve(Scanner sc)
    {
        var N = sc.Int;
        var D = sc.ArrInt;
        var ct = new int[10101];
        for (int i = 0; i < N; i++)
        {
            ct[D[i]]++;
        }
        var f = D.Max();
        for (int i = 1; i <= f; i++)
            if (f % i == 0) ct[i]--;
        var s = -1;
        for (int i = 10101 - 1; i >= 0; i--)
        {
            if (ct[i] > 0) { WriteLine($"{f} {i}"); break; }
        }
    }
}

#region Template
public static class Template
{
    static void Main(string[] args)
    {
        Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
        new Solver().Solve(new Scanner());
        Console.Out.Flush();
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static bool chmin<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) == 1) { a = b; return true; } return false; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static bool chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) == -1) { a = b; return true; } return false; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static void swap<T>(ref T a, ref T b) { var t = b; b = a; a = t; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static void swap<T>(this IList<T> A, int i, int j) { var t = A[i]; A[i] = A[j]; A[j] = t; }
    public static T[] Shuffle<T>(this IList<T> A) { T[] rt = A.ToArray(); Random rnd = new Random(); for (int i = rt.Length - 1; i >= 1; i--) swap(ref rt[i], ref rt[rnd.Next(i + 1)]); return rt; }
    public static T[] Create<T>(int n, Func<T> f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(); return rt; }
    public static T[] Create<T>(int n, Func<int, T> f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(i); return rt; }
    public static int CompareTo<T>(this T[] A, T[] B, Comparison<T> cmp = null) { cmp = cmp ?? Comparer<T>.Default.Compare; for (var i = 0; i < Min(A.Length, B.Length); i++) { int c = cmp(A[i], B[i]); if (c > 0) return 1; else if (c < 0) return -1; } if (A.Length == B.Length) return 0; if (A.Length > B.Length) return 1; else return -1; }
    public static int MaxElement<T>(this IList<T> A, Comparison<T> cmp = null) { cmp = cmp ?? Comparer<T>.Default.Compare; T max = A[0]; int rt = 0; for (int i = 1; i < A.Count; i++) if (cmp(max, A[i]) < 0) { max = A[i]; rt = i; } return rt; }
    public static void PopBack<T>(this List<T> A) => A.RemoveAt(A.Count - 1);
    public static void Fail<T>(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }
}
public class Scanner
{
    public string Str => Console.ReadLine().Trim();
    public int Int => int.Parse(Str);
    public long Long => long.Parse(Str);
    public double Double => double.Parse(Str);
    public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();
    public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();
    public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());
    public int[] ArrInt1D(int n) => Create(n, () => Int);
    public long[] ArrLong1D(int n) => Create(n, () => Long);
    public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);
    public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);
    private Queue<string> q = new Queue<string>();
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public T Next<T>() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }
    public void Make<T1>(out T1 v1) => v1 = Next<T1>();
    public void Make<T1, T2>(out T1 v1, out T2 v2) { v1 = Next<T1>(); v2 = Next<T2>(); }
    public void Make<T1, T2, T3>(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next<T3>(); }
    public void Make<T1, T2, T3, T4>(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next<T4>(); }
    public void Make<T1, T2, T3, T4, T5>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next<T5>(); }
    public void Make<T1, T2, T3, T4, T5, T6>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next<T6>(); }
    //public (T1, T2) Make<T1, T2>() { Make(out T1 v1, out T2 v2); return (v1, v2); }
    //public (T1, T2, T3) Make<T1, T2, T3>() { Make(out T1 v1, out T2 v2, out T3 v3); return (v1, v2, v3); }
    //public (T1, T2, T3, T4) Make<T1, T2, T3, T4>() { Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4); return (v1, v2, v3, v4); }
}
public class Pair<T1, T2> : IComparable<Pair<T1, T2>>
{
    public T1 v1;
    public T2 v2;
    public Pair() { }
    public Pair(T1 v1, T2 v2)
    { this.v1 = v1; this.v2 = v2; }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public int CompareTo(Pair<T1, T2> p)
    {
        var c = Comparer<T1>.Default.Compare(v1, p.v1);
        if (c == 0)
            c = Comparer<T2>.Default.Compare(v2, p.v2);
        return c;
    }
    public override string ToString() => $"{v1.ToString()} {v2.ToString()}";
    public void Deconstruct(out T1 a, out T2 b) { a = v1; b = v2; }
}

public class Pair<T1, T2, T3> : Pair<T1, T2>, IComparable<Pair<T1, T2, T3>>
{
    public T3 v3;
    public Pair() : base() { }
    public Pair(T1 v1, T2 v2, T3 v3) : base(v1, v2)
    { this.v3 = v3; }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public int CompareTo(Pair<T1, T2, T3> p)
    {
        var c = base.CompareTo(p);
        if (c == 0)
            c = Comparer<T3>.Default.Compare(v3, p.v3);
        return c;
    }
    public override string ToString() => $"{base.ToString()} {v3.ToString()}";
    public void Deconstruct(out T1 a, out T2 b, out T3 c) { Deconstruct(out a, out b); c = v3; }
}
#endregion

using System.Collections.Generic;
using System;

class _1108B
{
	static void Main()
	{
		int n = int.Parse(Console.ReadLine());
		List<int> d = new List<int>(Array.ConvertAll(Console.ReadLine().Split(), int.Parse));

		int x = 0;
		for (int i = 0; i < n; ++i)
		{
			x = Math.Max(x, d[i]);
		}
		for (int i = 1; i <= x; ++i)
		{
			if (x % i == 0)
			{
				d.Remove(i);
			}
		}
		int y = 0;
		for (int i = 0; i < d.Count; ++i)
		{
			y = Math.Max(y, d[i]);
		}
		Console.WriteLine(x + " " + y);
	}
}

using System;
using System.IO;
using System.Text;

namespace Divisors_of_Two_Integers
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            Solve(args);
            writer.Flush();
        }

        private static void Solve(string[] args)
        {
            int n = Next();

            var nn = new int[n];
            for (int i = 0; i < n; i++)
            {
                nn[i] = Next();
            }
            Array.Sort(nn);
            Array.Reverse(nn);

            writer.Write(nn[0]);
            writer.Write(' ');

            if (nn[0] == nn[1])
            {
                writer.WriteLine(nn[0]);
            }
            else
            {
                for (int i = 1; i < n; i++)
                {
                    if (nn[0]%nn[i] != 0)
                    {
                        writer.WriteLine(nn[i]);
                        return;
                    }
                    if (nn[i] == nn[i + 1])
                    {
                        writer.WriteLine(nn[i]);
                        return;
                    }
                }
            }
        }

        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;

public class Solver
{
    public void Solve()
    {
        int n = int.Parse(reader.ReadLine());
        string[] tokens = reader.ReadLine().Split(new char[]{ ' ' }, StringSplitOptions.RemoveEmptyEntries);

        List<int> list = new List<int>(n);
        foreach (string token in tokens)
        {
            list.Add(int.Parse(token));
        }

        list.Sort();

        int a = list[n - 1];

        List<int> listA = new List<int>();
        listA.Add(1);
        for (int i = 2; i <= a; i++)
        {
            if (a % i == 0)
            {
                listA.Add(i);
            }
        }

        int j = 0;
        for (int i = 0; i < listA.Count; i++)
        {
            for (; j < n; j++)
            {
                if (listA[i] == list[j])
                {
                    list.RemoveAt(j);
                    break;
                }
            }
        }

        int b = list[list.Count - 1];

        writer.WriteLine(a + " " + b);
    }

    static void Main()
    {
#if DEBUG
        reader = new StreamReader("..\\..\\input.txt");
        //reader = new StreamReader(Console.OpenStandardInput());
        writer = Console.Out;
        //writer = new StreamWriter("..\\..\\output.txt");
        Stopwatch watch = new Stopwatch();
        watch.Start();
#else
        reader = new StreamReader(Console.OpenStandardInput());
        writer = new StreamWriter(Console.OpenStandardOutput());
        //reader = new StreamReader("input.txt");
        //writer = new StreamWriter("output.txt");
#endif
        try
        {

            new Solver().Solve();
            //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);
            //thread.Start();
            //thread.Join();

#if DEBUG
            watch.Stop();
            writer.WriteLine("Stopwatch: " + watch.ElapsedMilliseconds + "ms");
#endif
        }
        catch (Exception ex)
        {
#if DEBUG
            Console.WriteLine(ex);
#else
            throw;
#endif
        }
        reader.Close();
        writer.Close();
    }
    protected static TextReader reader;
    protected static TextWriter writer;
}

using System;
using System.Linq;

namespace _1108B
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            var arr = Console.ReadLine().Split().Select(int.Parse).ToList();
            var arr2 = arr.Distinct().ToList();

            var max1 = arr2.Max();

            for(int i = 0; i<arr2.Count; i++)
            {
                if (max1 % arr2[i] == 0)
                    arr.Remove(arr2[i]);
            }

            int max2 = arr.Max();

            Console.WriteLine($"{max1} {max2}");
        }
    }
}

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

namespace Something
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = Console.ReadLine().Split(' ').Take(n).Select(int.Parse).ToArray();
            int mx = 0;
            for (int i = 0; i < n; ++i)
            {
                mx = Math.Max(mx, a[i]);

            }
            int mx2 = 0;
            for(int i = 0; i < n; ++i)
            {

                if(mx % a[i] != 0)
                {
                    mx2 = Math.Max(mx2, a[i]);
                }
            }
            if(mx2 != 0){
              Console.WriteLine("{0} {1}", mx, mx2);
            } else{
              int []cnt = new int[10005];
              for(int i = 0; i <= 10000; ++i) cnt[i] = 0;
              for(int i = 0; i < n; ++i){
                cnt[a[i]]++;
                if(cnt[a[i]] == 2){
                  mx2 = Math.Max(mx2, a[i]);
                }
              }
              Console.WriteLine("{0} {1}", mx, mx2);
            }
        }
    }
}

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

namespace ConsoleApplication30
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            Console.ReadLine();
            int[] array = Console.ReadLine().Split(' ').Select(n =>int.Parse(n)).ToArray();
            Dictionary<int,int> dictionary = new Dictionary<int, int>();
            for (int i = 0; i < array.Length; i++)
            {
                if (dictionary.ContainsKey(array[i])) dictionary[array[i]]++;
                else dictionary[array[i]] = 1;
            }

            Array.Sort(array);
            int firstMax = array[array.Length - 1];
            HashSet<int> setOfNumbers= new HashSet<int>();

            for (int i = 0; i < array.Length; i++)
            {
                if (firstMax % array[i] == 0)
                {
                    setOfNumbers.Add(array[i]);
                }
            }

            int[] buff = setOfNumbers.ToArray();
            for (int i = 0; i < buff.Length; i++)
            {
                dictionary[buff[i]]--;
            }
            List<int> list = new List<int>();

            foreach (var c in dictionary)
            {
                if (c.Value > 0)
                {
                    list.Add(c.Key);
                }
            }

            list.Sort();
            int secondMax = list[list.Count - 1];
            Console.WriteLine(firstMax + " " + secondMax);
        }
    }
}

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

namespace AlgoHelper
{

    class Programs
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();

            Dictionary<int,int> dict = new Dictionary<int, int>();

            for (int i = 0; i < a.Length; i++)
            {
                if (dict.ContainsKey(a[i])) dict[a[i]]++;
                else dict[a[i]] = 1;
            }

            Array.Sort(a);

            int max = a[a.Length - 1];

            HashSet<int> set= new HashSet<int>();

            for (int i = 0; i < a.Length; i++)
            {
                if (max % a[i] == 0)
                {
                    set.Add(a[i]);
                }
            }

            int[] b = set.ToArray();

            for (int i = 0; i < b.Length; i++)
            {
                dict[b[i]]--;
            }

            List<int> list = new List<int>();

            foreach (var c in dict)
            {
                if (c.Value > 0)
                {
                    list.Add(c.Key);
                }
            }

            list.Sort();

            int max2 = list[list.Count - 1];

            Console.WriteLine(max + " " + max2);

        //    Console.ReadKey();
        }

        private static int makePermutation(int[] a)
        {
            int count = 0;
            int n = a.Length;

            HashSet<int> set = new HashSet<int>();

            for (int i = 0; i < a.Length; i++)
            {
                if (a[i] >= 1 && a[i] <= n)
                {
                    if (!set.Contains(a[i]))
                    {
                        set.Add(a[i]);
                    }
                    else
                    {
                        count++;
                    }
                }

                else count++;
            }

            return count;
        }

        private static string parseValues(object o)
        {
            if (o is double)
            {
                double oo = (double) o ;
                return oo.ToString("0.#################");
            }

            return o.ToString();
        }
        static long sum(long n)
        {
            return n * (n + 1) / 2;
        }
        public int HIndex(int[] citations)
        {
            Array.Sort(citations);
            Console.WriteLine(string.Join("|",citations));
            int length = citations.Length;
            for (int i = citations.Length - 1; i >=0; i--)
            {
                int value = citations[i];
                if (length - i >= value && i < value) return value;
            }

            return 0;
        }

        public double FindMaxAverage(int[] nums, int k)
        {
            int[] prefix = prefixSum(nums);
            double max = prefix[k] / k;

            for (int i = 1; i <=prefix.Length - k; i++)
            {
                int sum = prefix[i + k] - nums[i-1];
                max = Math.Max(max, sum / k);
            }

            return max;
        }

        private static int [] prefixSum(int[] a)
        {
            int sum = 0;
            int [] prefix = new int[a.Length];
            for (int i = 0; i < a.Length; i++)
            {
                sum += a[i];
                prefix[i] = sum;
            }
            return prefix;
        }

        public static int LenLongestFibSubseq(int[] a)
        {
            int count = 2;
            int max = int.MinValue;

            int index = -1;
            int target = 0;

            for (int i = 0; i < a.Length - 1; i++)
            {
                int prev = a[i];
                int current = a[i+1];
                int currentIndex = i + 2;
                index = -1;

                for (int j = i + 1; j < a.Length;)
                {
                    if (index == -1)
                    {
                        target = a[i] + a[j];
                        index = customBinarySearch(a, target, j+1);
                        current = a[j];
                    }
                    else
                    {
                        target = prev + current;
                        index = customBinarySearch(a, target, currentIndex);
                    }

                    if (index == -1)
                    {
                        max = Math.Max(max, count);
                        j++;
                        count = 2;
                    }
                    else
                    {
                        prev = current;
                        current = a[index];
                        currentIndex = index + 1;
                        count++;
                    }
                }
            }

            max = Math.Max(max, count);

            return max == int.MinValue ? 0 : max;
        }

        private static int customBinarySearch(int[] a, int target, int index)
        {
            int lo = index;
            int hi = a.Length - 1;

            while (lo<=hi)
            {
                int med = hi - (hi - lo) / 2;
                if (a[med] == target) return med;
                else if (target < a[med]) hi = med - 1;
                else lo = med + 1;
            }
            return -1;
        }

        private static bool isFibonacciSequence(int[] a)
        {
            for (int i = 2; i < a.Length; i++)
            {
                if (a[i] != a[i - 1] + a[i - 2]) return false;
            }

            return true;
        }

        private static int LowerBound(int[] a, int i, int target)
        {
            int lo = i;
            int hi = a.Length - 1;

            if (target < a[lo]) return lo;

            int ans = -1;

            while (lo <= hi)
            {
                int med = hi - (hi - lo) / 2;

                if (a[med] == target)
                {
                    hi = med - 1;
                    ans = med;
                }
                else if (target > a[med])
                {
                    lo = med + 1;
                }
                else
                {
                    hi = med - 1;
                }
            }

            return ans;
        }

        private static int UpperBound(int[] a, int i, int target)
        {
            int lo = i;
            int hi = a.Length - 1;

            if (target > a[hi]) return hi;

            while (lo <= hi)
            {
                int med = hi - (hi - lo) / 2;

                if (a[med] == target)
                {
                    lo = med + 1;
                }
                else if (target > a[med])
                {
                    lo = med + 1;
                }
                else
                {
                    hi = med - 1;
                }
            }

            return hi;
        }

        private static int getValidMinSide(int a, int b)
        {
            int max = a > b ? a - b : b - a;

            int c = Math.Min(a + b, max);

            return c + 1;
        }

        private static int getValidMaxSide(int a, int b)
        {
            return a + b - 1;
        }

        private static int[] frequency(string s)
        {
            int[] a = new int[256];

            foreach (char c in s)
            {
                a[c]++;
            }

            return a;
        }

        public static int max(int[] a, int i)
        {
            if (i == a.Length - 1) return a[a.Length - 1];
            return Math.Max(a[i], max(a, i + 1));
        }

        private static bool isPrime(int n)
        {
            if (n < 2) return false;

            for (int i = 2; i * i <= n; i++)
            {
                if (n % i == 0) return false;
            }

            return true;
        }

        private static void Swap(ref char a, ref char b)
        {
            char temp = a;
            a = b;
            b = temp;
        }
    }

    class Pair
    {
        public int Left { get; set; }
        public int Right { get; set; }

        public Pair(int left, int right)
        {
            Left = left;
            Right = right;
        }

        public override string ToString()
        {
            return Left + "  " + Right;
        }
    }

}

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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){

		int X = A.Max();
		var h = new HashSet<int>();
		for(int j=1;j*j<=X;j++){
			if(X % j != 0) continue;
			h.Add(j);
			if(X / j != j) h.Add(X / j);
		}

		var l = new List<int>();
		for(int i=0;i<N;i++){
			if(h.Contains(A[i])){
				h.Remove(A[i]);
			} else {
				l.Add(A[i]);
			}
		}
		Console.WriteLine("{0} {1}",X, l.Max());

	}
	int N;
	int[] A;
	public Sol(){
		N = ri();
		A = ria();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}

//#define EXTENDSTACKSIZE

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;

namespace CF
{
    internal class Program
    {
        private const int stackSize = 32 * 1024 * 1024;

        private static void Run()
        {
            using (var sr = new InputReader(Console.In))
//            using (var sr = new InputReader(new StreamReader("input.txt")))
            using (var sw = Console.Out)
//            using (var sw = new StreamWriter("output.txt"))
            using (var task = new Task(sr, sw)) {
                task.Solve();
//                Console.ReadKey();
            }
        }

        private static void Main(string[] args)
        {
#if EXTENDSTACKSIZE
            var threadStart = new ThreadStart(Run);
            var thread = new Thread(threadStart, stackSize);
            thread.Start();
            thread.Join();
#else
            Run();
#endif
        }
    }

    internal class Task : IDisposable
    {
        private readonly InputReader sr;
        private readonly TextWriter sw;
        private bool isDispose;

        public Task(InputReader sr, TextWriter sw)
        {
            this.sr = sr;
            this.sw = sw;
        }

        public void Solve()
        {
            var n = sr.NextInt32();
            var numbers = sr.ReadArrayOfInt32();
            Array.Sort(numbers, (a, b) => -a.CompareTo(b));
            var x = numbers[0];
            var d1 = Divisors(x);
            for (var i = 1; i < numbers.Length; i++)
            {
                var y = numbers[i];
                var d2 = Divisors(y);
                var list = new List<int>(d1.Count + d2.Count);
                list.AddRange(d1);
                list.AddRange(d2);
                list.Sort((a, b) => -a.CompareTo(b));
                if (list.Count == numbers.Length)
                {
                    var can = true;
                    for (var j = 0; j < numbers.Length; j++)
                    {
                        if (numbers[j] != list[j])
                        {
                            can = false;
                            break;
                        }
                    }

                    if (can)
                    {
                        sw.WriteLine(x + " " + y);
                        return;
                    }
                }
            }
        }

        private HashSet<int> Divisors(int n)
        {
            var list = new HashSet<int>();
            var mid = Math.Sqrt(n);
            list.Add(1);
            list.Add(n);
            for (var i = 2; i <= mid; i++)
            {
                if (n % i == 0)
                {
                    list.Add(i);
                    list.Add(n / i);
                }
            }

            return list;
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        private void Dispose(bool disposing)
        {
            if (!isDispose) {
                if (disposing) {
                    if(sr != null)
                        sr.Dispose();

                    if(sw != null)
                        sw.Dispose();
                }

                isDispose = true;
            }
        }
    }
}

internal class InputReader : IDisposable
{
    private bool isDispose;
    private readonly TextReader sr;
    private string[] buffer;
    private int seek;

    public InputReader(TextReader stream)
    {
        sr = stream;
    }

    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    public string NextString()
    {
        var result = sr.ReadLine();
        return result;
    }

    public int NextInt32()
    {
        return Int32.Parse(ReadNextToken());
    }

    private string ReadNextToken()
    {
        if (buffer == null || seek == buffer.Length) {
            seek = 0;
            buffer = NextSplitStrings();
        }

        return buffer[seek++];
    }

    public long NextInt64()
    {
        return Int64.Parse(ReadNextToken());
    }

    public int[] ReadArrayOfInt32()
    {
        return ReadArray(Int32.Parse);
    }

    public long[] ReadArrayOfInt64()
    {
        return ReadArray(Int64.Parse);
    }

    public string[] NextSplitStrings()
    {
        return NextString()
            .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
    {
        return NextSplitStrings()
            .Select(s => func(s, CultureInfo.InvariantCulture))
            .ToArray();
    }

    public T[] ReadArrayFromString<T>(Func<string, CultureInfo, T> func, string str)
    {
        return
            str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(s => func(s, CultureInfo.InvariantCulture))
                .ToArray();
    }

    protected void Dispose(bool dispose)
    {
        if (!isDispose)
        {
            if (dispose)
                sr.Close();

            isDispose = true;
        }
    }

    ~InputReader()
    {
        Dispose(false);
    }
}

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

namespace Squarow
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = Convert.ToInt32(Console.ReadLine());
            string[] str = Console.ReadLine().Split(' ');
            int[] x = new int[N];
            for (int i = 0; i < N; i++)
                x[i] = Convert.ToInt32(str[i]);
            Array.Sort(x);
            int max = x.Last();
            for (int i = 0; i < N; i++)
            {
                if (i < N - 1 && x[i] == x[i + 1]) i++;
                if (max % x[i] == 0)
                    x[i] = 0;
            }
            Console.WriteLine(max + " " + x.Max());

           //           Console.ReadKey();

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;

namespace Rextester
{
    public class Program
    {
        public static void Main(string[] args)
        {

            int n = int.Parse(Console.ReadLine());
            string[] token = Console.ReadLine().Split();
            List<int> a = new List<int>();
            int l1 = int.MinValue;

            for(int i=0;i<n;i++){
               a.Add(int.Parse(token[i]));
            }

            int[] Ind = new int[10001];

            a.Sort();

            int fmax = a[n-1];
            Ind[fmax] = 1;

            for(int i=n-2;i>=0;i--){
              if(Ind[a[i]]==0 && fmax%a[i]==0){
                Ind[a[i]] = 1;
                a.Remove(a[i]);
              }
            }

            int N  = a.Count;

           Console.WriteLine(a[N-1] + " " + a[N-2]);

        }
    }
}

using System;
using System.Collections.Generic;

namespace СSharpTest
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = Int32.Parse(Console.ReadLine());
            var numbers = Console.ReadLine().Split(' ');
            resolve(numbers);
        }

        static void resolve(string[] numbers)
        {
            var hsFirst = new HashSet<int>();
            var max = 0;
            var maxDouble = 0;
            foreach(var number in numbers)
            {
                var n = Int32.Parse(number);
                if(n > max){
                    max = n;
                }

                if(!hsFirst.Add(n))
                {
                    if(n>maxDouble) {
                        maxDouble = n;
                    }
                    hsFirst.Remove(n);
                }

            }

            var singleMax = 0;
            hsFirst.Remove(max);
            foreach(var m in hsFirst)
            {
                if(singleMax < m && max%m != 0)
                {
                    singleMax = m;
                }
            }
            var resTwo = singleMax > maxDouble ? singleMax : maxDouble;

            Console.Write(max);
            Console.Write(" ");
            Console.Write(resTwo);

        }
    }
}

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

class Program {
    const int mod = 1000000007;

    static void Main() {
#if USE_IDE
        var exStdIn = new System.IO.StreamReader("./../../TestStdin.txt");
        Console.SetIn(exStdIn);
#endif
        var n = int.Parse(Console.ReadLine());
        var a = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);

        var x = a.Max();
        List<int> b = new List<int>(a);
        b.Remove(x);
        // 約数除外
        for (int i = x / 2; i > 0; i--) {
            if (x % i == 0) {
                b.Remove(i);
            }
        }

        var y = b.Max();
        Console.WriteLine(x + " " + y);
    }
}

/* Date: 23.01.2019 * Time: 21:45 */
//
// ������������ ����� �� ����� 6

/*
�	fflush(stdout) � ����� C++;
�	System.out.flush() � Java;
�	stdout.flush() � Python;
�	flush(output) � Pascal;

*/

using System;
using System.Globalization;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

class Example
{
	public static void Main (string[] args)
	{
# if ( ! ONLINE_JUDGE )
		StreamReader sr = new StreamReader ("C:\\TRR\\2019\\Task\\07 Codeforces\\036\\B.TXT");
		StreamWriter sw = new StreamWriter ("C:\\TRR\\2019\\Task\\07 Codeforces\\036\\B.OUT");
# endif

		NumberFormatInfo nfi = NumberFormatInfo.InvariantInfo;
		string s;

# if ( ONLINE_JUDGE )
		s = Console.ReadLine ();
# else
		s = sr.ReadLine ();
# endif

		int n = int.Parse (s);
		int [] d = new int [n];

# if ( ONLINE_JUDGE )
		s = Console.ReadLine ();
# else
		s = sr.ReadLine ();
		sw.WriteLine ("*** n = " + n);
		sw.WriteLine ("*** " + s);
# endif

		string [] s0 = s.Split (' ');
		for ( int i=0; i < n; i++ )
			d [i] = int.Parse (s0 [i]);

		Array.Sort (d);
		int a = 0, b = d [n-1];

		int k = 0;
		for ( int i=0; i < n; i++ )
			if ( i < n-1 && d [i] == d [i+1] )
			{
				k = d [i];
				i++;
			}
			else
			{
				if ( b % d [i] != 0 )
					k = d [i];
			}

		if ( k == 0 )
			a = b;
		else
			a = k;

# if ( ONLINE_JUDGE )
		Console.WriteLine (a + " " + b);
# else
		sw.Write ("***");
		for ( int i=0; i < n; i++ )
			sw.Write (" " + d [i]);
		sw.WriteLine ();
		sw.WriteLine (a + " " + b);
		sw.Close ();
# endif
	}
}

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

namespace CodeForces
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var parts = Console.ReadLine().Split(' ');
            var divs = parts.Select(int.Parse).ToArray();

            Array.Sort(divs);
            int x = -1, y = divs[n - 1];

            for (int i = 0; i < n-1; i++)
            {
                if (divs[i] == divs[i+1])
                {
                    x = divs[i];
                    i++;
                }
                else if (y % divs[i] != 0)
                {
                    x = divs[i];
                }
            }

            Console.WriteLine("{0} {1}", y, x);
        }
    }
}

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

namespace SolutionsForCodeforces
{
    class IHateNumbers
    {
        static void Main()
        {
            var Number = Convert.ToInt32(Console.ReadLine());//Number of Div.
            var temp = Console.ReadLine();
            var atemp = temp.Split(' ');
            var Dividers = from l in atemp
                           select Convert.ToInt32(l); //Divide
            int Max = Dividers.Max(); //MAX
            Console.WriteLine(Convert.ToString(Max) + " ");
            var DivForMaxTemp = Dividers.Distinct();
            var DivForMax = from l in DivForMaxTemp//  Div Max
                            where Max % l == 0
                            select l;
            var DivForSecond = from l in Dividers // Div Second
                               where !DivForMax.Contains(l)
                               select l;
            if (DivForSecond.Count() > 0)
            {
                Console.Write(DivForSecond.Max());
            }
            else
            {
                var a = Get(Dividers);
                Console.Write(a.Max());
            }
        }
        static List<int> Get(IEnumerable<int> IN)
        {
            List<int> rezult = new List<int>();
            var hashset = new HashSet<int>();
            foreach (var name in IN)
            {
                if (!hashset.Add(name))
                {
                    rezult.Add(name);
                }
            }
            return rezult;
        }
    }
}

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

namespace Codeforces
{
	class Program
	{
		static void Main(string[] args)
		{
			var n = Ri();
			var d = Ria();
			int mx = d.Max();
			var h = new HashSet<int>();
			for(int i=1;i<=mx;i++)
			{
				if(mx%i==0)
				{
					h.Add(i);
				}
			}

			var l = new List<int>();
			foreach(var x in d)
			{
				if(h.Contains(x))
				{
					h.Remove(x);
				}
				else
				{
					l.Add(x);
				}
			}
			Console.WriteLine("{0} {1}", mx, l.Max());
		}

		static String Rs() { return Console.ReadLine(); }
		static int Ri() { return int.Parse(Console.ReadLine()); }
		static long Rl() { return long.Parse(Console.ReadLine()); }
		static double Rd() { return double.Parse(Console.ReadLine()); }
		static String[] Rsa(char sep=' ') { return Console.ReadLine().Split(sep); }
		static int[] Ria(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); }
		static long[] Rla(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); }
		static double[] Rda(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); }
	}
}

using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Resources;
using System.Text;

namespace Codeforces
{
	class Program
	{
		static void Main(string[] args)
		{
			string input1 = Console.ReadLine();
			string input2 = Console.ReadLine();

			//string input3 = Console.ReadLine();
			//string input4 = Console.ReadLine();

			//var inputs1 = input1.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();
			var inputs2 = input2.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToList();

			long n = long.Parse(input1);
			long x = inputs2.Max();
			for (long i = 1; i <= x / 2; i++)
			{
				if (x % i > 0)
				{
					continue;
				}

				var index = inputs2.IndexOf(i);
				if (index >= 0)
				{
					inputs2.RemoveAt(index);
				}
			}

			inputs2.Remove(x);
			long y = inputs2.Max();
			Console.WriteLine($"{x} {y}");
		}

		public static void Print(int[] number)
		{
			var stringBuilder = new StringBuilder();
			foreach (var i in number)
			{
				if (i == 0 && stringBuilder.Length == 0)
				{
					continue;
				}

				stringBuilder.Append(i);
			}

			Console.WriteLine(stringBuilder.ToString());
		}

		public void Method1(ref int n1, ref int n2, ref int k1, ref int k2)
		{
			double a = (double)n1 / k1;
			double b = (double)n2 / k2;
			if (n1 >= n2 || (a >= b && a < 2 * b))
			{

			}
		}

		public void Method2(ref int n1, ref int n2, ref int k1, ref int k2)
		{
			double a = (double)n1 / k1;
			double b = (double)n2 / k2;
			if (n2 >= n1 || (b >= a && b < 2 * a))
			{

			}
		}

		public class Node
		{
			public int Count { get; set; }

			public int FirstIndex { get; set; } = -1;

			public int LastIndex { get; set; } = -1;
		}

		//public class Node<T>
		//{
		//	public Node<T> Left { get; set; }

		//	public Node<T> Right { get; set; }

		//	public T Value { get; set; }

		//	public Node(T value)
		//	{
		//		Value = value;
		//	}
		//}

		//public class Tree<T>
		//{
		//	public Node<T> Root { get; set; }

		//	public Tree(T value)
		//	{
		//		Root = new Node<T>(value);
		//	}
		//}

		private static long GCD(long a, long b)
		{
			long max = Math.Max(a, b);
			long min = Math.Min(a, b);

			if (min == 0)
			{
				return max;
			}

			a = min;
			b = max % min;
			return GCD(a, b);
		}

		private static long LCM(long a, long b)
		{
			return Math.Abs(a * b) / GCD(a, b);
		}

		//private static int Length(short[] a)
		//{
		//	int firstItemIndex = 0;
		//	for (int i = 0; i < a.Length; i++)
		//	{
		//		if (a[i] == 0)
		//		{
		//			continue;
		//		}

		//		firstItemIndex = i;
		//		break;
		//	}

		//	return a.Length - firstItemIndex;
		//}

		//private static short[] Subtract(short[] a, short[] b)
		//{
		//	if (a.Length != b.Length)
		//	{
		//		throw new ArgumentException();
		//	}

		//	short[] result = new short[a.Length];
		//	Array.Copy(a, result, a.Length);
		//	for (int i = result.Length - 1; i >= 0; i--)
		//	{
		//		if (result[i] < b[i])
		//		{
		//			int j = i - 1;
		//			while (result[j] == 0)
		//			{
		//				result[j--] = 9;
		//			}

		//			result[j]--;
		//			result[i] += 10;
		//		}

		//		result[i] -= b[i];
		//	}

		//	return result;
		//}

		//private static short[] Multiply(short[] a, int b)
		//{
		//	short[] result = new short[a.Length];
		//	for (int i = a.Length - 1; i > 0; i--)
		//	{
		//		int temp = a[i] * b;
		//		result[i] = (short)(result[i] + temp % 10);
		//		result[i - 1] = (short)(result[i - 1] + temp / 10);
		//	}

		//	return result;
		//}

		//private static int Mod(short[] a, int b)
		//{
		//	int rest = 0, i = 0;
		//	while (i < a.Length)
		//	{
		//		int d = 10 * rest + a[i];
		//		while (d < b && i < a.Length - 1)
		//		{
		//			d = 10 * d + a[++i];
		//		}

		//		rest = d % b;
		//		i++;
		//	}

		//	return rest;
		//}

		//private static short[] Divide(short[] a, int b)
		//{
		//	short[] result = new short[a.Length];
		//	int rest = 0, i = 0;
		//	while (i < a.Length)
		//	{
		//		int d = 10 * rest + a[i];
		//		while (d < b && i < a.Length - 1)
		//		{
		//			d = 10 * d + a[++i];
		//		}

		//		result[i] = (short)(d / b);
		//		rest = d % b;
		//		i++;
		//	}

		//	return result;
		//}
	}
}

using System;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = Convert.ToInt32(Console.ReadLine());
            var line = Console.ReadLine().Split(' ');
            var d = new int[n];
            for (int i = 0; i < n; i++)
            {
                d[i] = Convert.ToInt32(line[i]);
            }
            var x = d.Max();
            var notDivisorOfX = from di in d
                                where x % di != 0
                                select di;
            int y;
            if (notDivisorOfX.Count() > 0)
            {
                y = notDivisorOfX.Max();
            }
            else
            {
                var dWithoutX = d.ToList();
                dWithoutX.Remove(x);
                var freq2 = from di in dWithoutX
                            where d.Count(a => a == di) == 2
                            select di;
                y = freq2.Max();
            }

            Console.WriteLine("{0} {1}", x, y);
        }

    }
}

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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var data = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var a = data.Max();
            var numbers = new int[10001];
            for (int i = 0; i < data.Length; i++)
                numbers[data[i]]++;
            for (int i = 1; i < numbers.Length; i++)
                if (a%i == 0)
                    numbers[i]--;
            var b = -1;
            for (int i = numbers.Length-1; i >= 0; i--)
            {
                if (numbers[i] != 0)
                {
                    b = i;
                    break;
                }
            }

            Console.WriteLine(a + " " + b);
        }
    }
}

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

namespace Codeforces
{
    class _1108B
    {
        public static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = new int[n];
            int max = 0;
            int pos = 0;
            string[] ss = Console.ReadLine().Split();
            for (int i = 0; i < n; i++)
            {
                int m = int.Parse(ss[i]);
                a[i] = m;
                if (a[i] > max)
                {
                    max = a[i];
                    pos = i;
                }
            }
            Console.Write(max);
            Console.Write(" ");
            for (int i = 0; i < n; i++)
            {
                if (max % a[i] == 0)
                {
                    max = max / a[i];
                    a[i] = 0;
                }
            }
            a[pos] = 0;
            max = 0;
            for(int i = 0; i < n; i++)
            {
                if (a[i] > max)
                    max = a[i];
            }
            Console.WriteLine(max);
        }
    }
}

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

namespace a
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var l = Console.ReadLine().Split().Select(int.Parse).ToList();
            var t = l;
            var r1 = l.Max();
            var r2 = 0;
            var d = new List<int>();
            for (int i = 0; i < l.Count(); i++)
            {
                if (r1 % l[i] == 0)
                {
                    t.Remove(l[i]);
                }
            }

            r2 = t.Max();
            Console.WriteLine(r1 + " " + r2);
            //Console.ReadKey();
        }
    }
}

using System;
using System.Collections.Generic;

namespace _1108B_Divisors_of_Two_Integers
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Int32.Parse(Console.ReadLine());
            string [] numbers = Console.ReadLine().Split();
            var divisors1 = new SortedSet<int>();
            var divisors2 = new SortedSet<int>();

            for (int i = 0; i < n; i++)
            {
                if (divisors1.Contains(Int32.Parse(numbers[i])))
                {
                    divisors2.Add(Int32.Parse(numbers[i]));
                }
                else
                {
                    divisors1.Add(Int32.Parse(numbers[i]));
                }
            }

            int x, y = 0;
            x = divisors1.Max;
            var toRemove = new List<int>();

            foreach (var item in divisors1)
            {
                if (x/item % 1 == 0)
                {
                    toRemove.Add(x/item);
                }
            }

            foreach (var item in toRemove)
            {
                divisors1.Remove(item);
            }

            if (divisors1.Count == 0)
            {
                y = divisors2.Max;
            }
            else
            {
                y = Math.Max(divisors1.Max, divisors2.Max);
            }

            Console.WriteLine(x + " " + y);
        }
    }
}

using System;
using System.Collections.Generic;

namespace _1108B_Divisors_of_Two_Integers
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Int32.Parse(Console.ReadLine());
            string [] numbers = Console.ReadLine().Split();
            var divisors = new List<int>();

            for (int i = 0; i < n; i++)
                divisors.Add(Int32.Parse(numbers[i]));

            divisors.Sort();

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

            int x, y;
            x = divisors[n-1];
            var toRemove = new List<int>();

            foreach (var item in divisors)
            {
                if (x/item % 1 == 0)
                    toRemove.Add(x/item);
            }

            foreach (var item in toRemove)
            {
                divisors.Remove(item);
            }

            y = divisors[divisors.Count-1];

            Console.WriteLine(x + " " + y);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Text;

namespace codeforces
{

    class Program
    {
        const int N = 128;

        static int[] a = new int[N];

        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            var s = Console.ReadLine().Split(' ');
            int fIndex = 0;
            for (int i = 0; i < n; ++i)
            {
                a[i] = int.Parse(s[i]);
                if (a[fIndex] < a[i])
                {
                    fIndex = i;
                }
            }
            for (int i = 0; i < n; ++i)
            {
                if (i == fIndex)
                {
                    continue;
                }
                bool check = true;
                for (int j = 0; j < n; ++j)
                {
                    if (a[i] % a[j] != 0 && a[fIndex] % a[j] != 0)
                    {
                        check = false;
                        break;
                    }
                }
                if (check)
                {
                    Console.Write(a[fIndex] + " " + a[i]);
                    break;
                }
            }
            Console.Read();
        }
    }
}

using System;
using System.Linq;

namespace _1108B
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            var arr = Console.ReadLine().Split().Select(int.Parse).ToArray();

            var max1 = arr.Max();

            var arr2 = arr.Where(a => max1 % a != 0).ToArray();
            int max2 = 0;

            if (arr2.Length != 0)
                max2 = arr2.Max();

            if (max2 == 0)
                max2 = max1;

            Console.WriteLine($"{max1} {max2}");
        }
    }
}

using System;
using System.Linq;

namespace _1108B
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            var arr = Console.ReadLine().Split().Select(int.Parse).ToArray();

            var max1 = arr.Max();

            var arr2 = arr.Where(a => max1 % a != 0).ToArray();
            int max2 = 0;

            if (arr2.Length != 0)
                max2 = arr2.Max();

            if (max2 == 0)
                max2 = arr.Min();

            Console.WriteLine($"{max1} {max2}");
        }
    }
}

using System;
using System.Linq;

namespace _1108B
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            var arr = Console.ReadLine().Split().Select(int.Parse).ToArray();

            var max1 = arr.Max();

            var arr2 = arr.Where(a => max1 % a != 0).ToArray();
            int max2 = 0;

            if (arr2.Length != 0)
                max2 = arr2.Max();

            if (max2 == 0 && n % 2==0)
                max2 = max1;

            if (max2 == 0 && n % 2 == 1)
                max2 = max1;

            Console.WriteLine($"{max1} {max2}");
        }
    }
}

using System;
using System.Linq;

namespace _1108B
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            var arr = Console.ReadLine().Split().Select(int.Parse).ToArray();

            var max1 = arr.Max();

            var arr2 = arr.Where(a => max1 % a != 0).ToArray();
            int max2 = 0;

            if (arr2.Length != 0)
                max2 = arr2.Max();

            if (max2 == 0 && n % 2==0)
                max2 = max1;

            if (max2 == 0 && n % 2 == 1)
                max2 = arr.Min() ;

            Console.WriteLine($"{max1} {max2}");
        }
    }
}

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

namespace Something
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = Console.ReadLine().Split(' ').Take(n).Select(int.Parse).ToArray();
            int mx = 0;
            int cnt = 0;
            for (int i = 0; i < n; ++i)
            {
                mx = Math.Max(mx, a[i]);

            }
            int mx2 = 0;
            for(int i = 0; i < n; ++i)
            {

                if(a[i] == mx){
                  ++cnt;
                }
                if(mx % a[i] != 0)
                {
                    mx2 = Math.Max(mx2, a[i]);
                }
            }
            if(mx2 != 0){
              Console.WriteLine("{0} {1}", mx, mx2);
            } else{
              if(cnt >= 2){
                Console.WriteLine("{0} {1}", mx, mx);
              } else{
                if(a[0] == mx){
                  Console.WriteLine("{0} {1}", a[1], mx);
                } else{
                  Console.WriteLine("{0} {1}", a[0], mx);
                }
              }
            }
        }
    }
}

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

namespace Something
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = Console.ReadLine().Split(' ').Take(n).Select(int.Parse).ToArray();
            int mx = 0;
            for (int i = 0; i < n; ++i)
            {
                mx = Math.Max(mx, a[i]);

            }
            int mx2 = 0;
            for(int i = 0; i < n; ++i)
            {

                if(mx % a[i] != 0)
                {
                    mx2 = Math.Max(mx2, a[i]);
                }
            }
            if(mx2 != 0){
              Console.WriteLine("{0} {1}", mx, mx2);
            } else{
              int []cnt = new int[10005];
              for(int i = 0; i <= 10000; ++i) cnt[i] = 0;
              for(int i = 0; i < n; ++i){
                cnt[a[i]]++;
                if(cnt[a[i]] == 2){
                  Console.WriteLine("{0} {1}", mx, a[i]);
                  break;
                }
              }
            }
        }
    }
}

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

namespace Something
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = Console.ReadLine().Split(' ').Take(n).Select(int.Parse).ToArray();
            int mx = 0;
            for (int i = 0; i < n; ++i)
            {
                mx = Math.Max(mx, a[i]);
            }
            int mx2 = 0;
            for(int i = 0; i < n; ++i)
            {
                if(mx % a[i] != 0)
                {
                    mx2 = Math.Max(mx2, a[i]);
                }
            }
            Console.WriteLine("{0} {1}", mx, mx2);

        }
    }
}

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

namespace Something
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = Console.ReadLine().Split(' ').Take(n).Select(int.Parse).ToArray();
            int mx = 0;
            for (int i = 0; i < n; ++i)
            {
                mx = Math.Max(mx, a[i]);
            }
            int mx2 = 0;
            for(int i = 0; i < n; ++i)
            {
                if(a[i] % mx != 0)
                {
                    mx2 = Math.Max(mx2, a[i]);
                }
            }
            Console.WriteLine("{0} {1}", mx, mx2);

        }
    }
}

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

namespace ConsoleApplication29
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            Console.ReadLine();
            int[] array = Console.ReadLine().Split(' ').Select(n =>int.Parse(n)).ToArray();
            Dictionary<int,int> dictionary = new Dictionary<int, int>();

            for (int i = 0; i < array.Length; i++)
                if (dictionary.ContainsKey(array[i]))
                    dictionary[array[i]]++;
                else
                    dictionary[array[i]] = 1;

            int firstMax = array[array.Length - 1];
            Array.Sort(array);
            HashSet<int> hashSet= new HashSet<int>();

            for (int i = 0; i < array.Length; i++)
                if (firstMax % array[i] == 0)
                    hashSet.Add(array[i]);

            int[] buff = hashSet.ToArray();
            for (int i = 0; i < buff.Length; i++)
                dictionary[buff[i]]--;

            List<int> list = new List<int>();
            foreach (var c in dictionary)
                if (c.Value > 0)
                    list.Add(c.Key);

            list.Sort();

            Console.WriteLine(firstMax + " " + list[list.Count - 1]);
        }
    }
}

//#define EXTENDSTACKSIZE

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;

namespace CF
{
    internal class Program
    {
        private const int stackSize = 32 * 1024 * 1024;

        private static void Run()
        {
            using (var sr = new InputReader(Console.In))
//            using (var sr = new InputReader(new StreamReader("input.txt")))
            using (var sw = Console.Out)
//            using (var sw = new StreamWriter("output.txt"))
            using (var task = new Task(sr, sw)) {
                task.Solve();
//                Console.ReadKey();
            }
        }

        private static void Main(string[] args)
        {
#if EXTENDSTACKSIZE
            var threadStart = new ThreadStart(Run);
            var thread = new Thread(threadStart, stackSize);
            thread.Start();
            thread.Join();
#else
            Run();
#endif
        }
    }

    internal class Task : IDisposable
    {
        private readonly InputReader sr;
        private readonly TextWriter sw;
        private bool isDispose;

        public Task(InputReader sr, TextWriter sw)
        {
            this.sr = sr;
            this.sw = sw;
        }

        public void Solve()
        {
            var n = sr.NextInt32();
            var numbers = sr.ReadArrayOfInt32();
            var x = numbers.Max();
            var removed = new List<int>();
            for (var i = 0; i < numbers.Length; i++)
            {
                if (x % numbers[i] != 0)
                {
                    removed.Add(numbers[i]);
                }
            }

            int y;
            if (removed.Count == 0)
            {
                Array.Sort(numbers, (a, b) => -a.CompareTo(b));
                y = numbers[1];
            }
            else
            {
                y = removed.Max();
            }

            sw.Write(x + " " + y);
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        private void Dispose(bool disposing)
        {
            if (!isDispose) {
                if (disposing) {
                    if(sr != null)
                        sr.Dispose();

                    if(sw != null)
                        sw.Dispose();
                }

                isDispose = true;
            }
        }
    }
}

internal class InputReader : IDisposable
{
    private bool isDispose;
    private readonly TextReader sr;
    private string[] buffer;
    private int seek;

    public InputReader(TextReader stream)
    {
        sr = stream;
    }

    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    public string NextString()
    {
        var result = sr.ReadLine();
        return result;
    }

    public int NextInt32()
    {
        return Int32.Parse(ReadNextToken());
    }

    private string ReadNextToken()
    {
        if (buffer == null || seek == buffer.Length) {
            seek = 0;
            buffer = NextSplitStrings();
        }

        return buffer[seek++];
    }

    public long NextInt64()
    {
        return Int64.Parse(ReadNextToken());
    }

    public int[] ReadArrayOfInt32()
    {
        return ReadArray(Int32.Parse);
    }

    public long[] ReadArrayOfInt64()
    {
        return ReadArray(Int64.Parse);
    }

    public string[] NextSplitStrings()
    {
        return NextString()
            .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
    {
        return NextSplitStrings()
            .Select(s => func(s, CultureInfo.InvariantCulture))
            .ToArray();
    }

    public T[] ReadArrayFromString<T>(Func<string, CultureInfo, T> func, string str)
    {
        return
            str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(s => func(s, CultureInfo.InvariantCulture))
                .ToArray();
    }

    protected void Dispose(bool dispose)
    {
        if (!isDispose)
        {
            if (dispose)
                sr.Close();

            isDispose = true;
        }
    }

    ~InputReader()
    {
        Dispose(false);
    }
}

//#define EXTENDSTACKSIZE

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;

namespace CF
{
    internal class Program
    {
        private const int stackSize = 32 * 1024 * 1024;

        private static void Run()
        {
            using (var sr = new InputReader(Console.In))
//            using (var sr = new InputReader(new StreamReader("input.txt")))
            using (var sw = Console.Out)
//            using (var sw = new StreamWriter("output.txt"))
            using (var task = new Task(sr, sw)) {
                task.Solve();
//                Console.ReadKey();
            }
        }

        private static void Main(string[] args)
        {
#if EXTENDSTACKSIZE
            var threadStart = new ThreadStart(Run);
            var thread = new Thread(threadStart, stackSize);
            thread.Start();
            thread.Join();
#else
            Run();
#endif
        }
    }

    internal class Task : IDisposable
    {
        private readonly InputReader sr;
        private readonly TextWriter sw;
        private bool isDispose;

        public Task(InputReader sr, TextWriter sw)
        {
            this.sr = sr;
            this.sw = sw;
        }

        public void Solve()
        {
            var n = sr.NextInt32();
            var numbers = sr.ReadArrayOfInt32();
            Array.Sort(numbers, (a, b) => -a.CompareTo(b));
            var x = numbers[0];
            var contains = new int[(int)1e4 + 1];
            foreach (var i in numbers)
            {
                contains[i]++;
            }
            var set = new HashSet<int>();
            foreach (var i in numbers)
            {
                if (x % i != 0)
                {
                    set.Add(i);
                }
            }
            for (var j = 1; j < numbers.Length; j++)
            {
                var i = numbers[j];
                if (contains[i] > 0)
                {
                    if (contains[i] > 1)
                    {
                        sw.Write(x + " " + i);
                        return;
                    }

                    var can = set.All(item => item % i == 0);
                    if (can)
                    {
                        sw.Write(x + " " + i);
                        return;
                    }
                }
            }
            throw new InvalidOperationException();
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        private void Dispose(bool disposing)
        {
            if (!isDispose) {
                if (disposing) {
                    if(sr != null)
                        sr.Dispose();

                    if(sw != null)
                        sw.Dispose();
                }

                isDispose = true;
            }
        }
    }
}

internal class InputReader : IDisposable
{
    private bool isDispose;
    private readonly TextReader sr;
    private string[] buffer;
    private int seek;

    public InputReader(TextReader stream)
    {
        sr = stream;
    }

    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    public string NextString()
    {
        var result = sr.ReadLine();
        return result;
    }

    public int NextInt32()
    {
        return Int32.Parse(ReadNextToken());
    }

    private string ReadNextToken()
    {
        if (buffer == null || seek == buffer.Length) {
            seek = 0;
            buffer = NextSplitStrings();
        }

        return buffer[seek++];
    }

    public long NextInt64()
    {
        return Int64.Parse(ReadNextToken());
    }

    public int[] ReadArrayOfInt32()
    {
        return ReadArray(Int32.Parse);
    }

    public long[] ReadArrayOfInt64()
    {
        return ReadArray(Int64.Parse);
    }

    public string[] NextSplitStrings()
    {
        return NextString()
            .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
    {
        return NextSplitStrings()
            .Select(s => func(s, CultureInfo.InvariantCulture))
            .ToArray();
    }

    public T[] ReadArrayFromString<T>(Func<string, CultureInfo, T> func, string str)
    {
        return
            str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(s => func(s, CultureInfo.InvariantCulture))
                .ToArray();
    }

    protected void Dispose(bool dispose)
    {
        if (!isDispose)
        {
            if (dispose)
                sr.Close();

            isDispose = true;
        }
    }

    ~InputReader()
    {
        Dispose(false);
    }
}

/* Date: 23.01.2019 * Time: 21:45 */
// *

/*
�	fflush(stdout) � ����� C++;
�	System.out.flush() � Java;
�	stdout.flush() � Python;
�	flush(output) � Pascal;

*/

using System;
using System.Globalization;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

class Example
{
	public static void Main (string[] args)
	{
# if ( ! ONLINE_JUDGE )
		StreamReader sr = new StreamReader ("C:\\TRR\\2019\\Task\\07 Codeforces\\036\\B.TXT");
		StreamWriter sw = new StreamWriter ("C:\\TRR\\2019\\Task\\07 Codeforces\\036\\B.OUT");
# endif

		NumberFormatInfo nfi = NumberFormatInfo.InvariantInfo;
		string s;

# if ( ONLINE_JUDGE )
		s = Console.ReadLine ();
# else
		s = sr.ReadLine ();
# endif

		int n = int.Parse (s);
		int [] d = new int [n];

# if ( ONLINE_JUDGE )
		s = Console.ReadLine ();
# else
		s = sr.ReadLine ();
		sw.WriteLine ("*** n = " + n);
		sw.WriteLine ("*** " + s);
# endif

		string [] s0 = s.Split (' ');
		for ( int i=0; i < n; i++ )
			d [i] = int.Parse (s0 [i]);

		Array.Sort (d);
		int a = 0, b = d [n-1];

		int k = 0;
		for ( int i=0; i < n; i++ )
			if ( i < n-1 && d [i] == d [i+1] )
				i++;
			else
			{
				if ( b % d [i] != 0 )
					k = d [i];
			}

		if ( k == 0 )
			a = b;
		else
			a = k;

# if ( ONLINE_JUDGE )
		Console.WriteLine (a + " " + b);
# else
		sw.Write ("***");
		for ( int i=0; i < n; i++ )
			sw.Write (" " + d [i]);
		sw.WriteLine ();
		sw.WriteLine (a + " " + b);
		sw.Close ();
# endif
	}
}

using System;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = Convert.ToInt32(Console.ReadLine());
            var line = Console.ReadLine().Split(' ');
            var d = new int[n];
            for (int i = 0; i < n; i++)
            {
                d[i] = Convert.ToInt32(line[i]);
            }
            var x = d.Max();
            var notDivisorOfX = from di in d
                                where x % di != 0
                                select di;
            int y;
            if (notDivisorOfX.Count() > 0)
            {
                y = notDivisorOfX.Max();
            }
            else
            {
                var r = d.ToList();
                r.Remove(x);
                y = r.Max();
            }

            Console.WriteLine("{0} {1}", x, y);
        }

    }
}