n = int(raw_input())
a = map(int, raw_input().split())

chot = max(a)
a2 = []
for i in a:
    if (chot%i==0) and (i not in a2):
        a2.append(i)
for i in a2:
    a.remove(i)
chot1 = max(a)
print chot, chot1

"Template made by : https://codeforces.com/profile/c1729 , github repo : https://github.com/cheran-senthil/PyRival"
from __future__ import division, print_function
import bisect
import math
import itertools
import sys
from atexit import register

if sys.version_info[0] < 3:
    from io import BytesIO as stream
else:
    from io import StringIO as stream

if sys.version_info[0] < 3:
    class dict(dict):
        """dict() -> new empty dictionary"""
        def items(self):
            """D.items() -> a set-like object providing a view on D's items"""
            return dict.iteritems(self)

        def keys(self):
            """D.keys() -> a set-like object providing a view on D's keys"""
            return dict.iterkeys(self)

        def values(self):
            """D.values() -> an object providing a view on D's values"""
            return dict.itervalues(self)

    input = raw_input
    range = xrange

    filter = itertools.ifilter
    map = itertools.imap
    zip = itertools.izip

def sync_with_stdio(sync=True):
    """Set whether the standard Python streams are allowed to buffer their I/O.

    Args:
        sync (bool, optional): The new synchronization setting.

    """
    global input, flush

    if sync:
        flush = sys.stdout.flush
    else:
        sys.stdin = stream(sys.stdin.read())
        input = lambda: sys.stdin.readline().rstrip('\r\n')

        sys.stdout = stream()
        register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))

def main():
    n=int(input())
    l1=list(map(int,input().split()))
    m=max(l1)
    t=1
    f=1
    d1={}
    for item in l1:
        if item in d1:
            d1[item]+=1
        else :
            d1[item]=1
    for i in range(1,m+1):
        if m%i==0:
            d1[i]-=1
            if d1[i]==0:
                del d1[i]
    print(m,max(d1))
if __name__ == '__main__':
    sync_with_stdio(False)
    main()

n=int(input())
arr=list(map(int,input().split()))
arr.sort()
x=arr[-1]
flag=1
#print(arr)
if n==2:
	print(arr[0],arr[1])
else:
	for i in range(n-2,-1,-1):
		if x%arr[i]!=0:
			y=arr[i]
			flag=0
			break
	if flag:
		for i in range(n-1,0,-1):
			if arr[i]==arr[i-1]:
				y=arr[i]
				break
	print(x,y)

from fractions import gcd
from collections import Counter

def lcm(a,b):
    return (a*b)//gcd(a,b)

input()
arr=list(map(int,input().split()))

count=Counter(arr)

a=max(arr)
b=1

for x in count:
    if a%x!=0 or count[x]>1:
        b=lcm(b,x)

print(str(a)+' '+str(b))

n=int(input())
a=list(map(int,input().split()))
arr=[]
for i in a:
	if i!=1:
		arr.append(i)
if len(arr)==0:
	print(1,1)
	exit()

# print(kaamka)
d={}
for i in a:
	if i in d:
		d[i]+=1
	else:
		d[i]=1
both=[]
for key,value in d.items():
	if value==2:
		both.append(key)
a=sorted(a)
if len(a)==2:
	print(a[0],a[1])
	exit()
if len(arr)==1:
	print(a[0],a[-1])
	exit()
arr=sorted(arr)
for i in range(len(a)):
	for j in range(i+1,len(a)):
		f1=True
		x=a[i]
		y=a[j]
		for k in range(len(both)):
			if x%both[k]!=0 or y%both[k]!=0:
				f1=False
				break
		f2=True
		for k in range(len(a)):
			if x%a[k]!=0 and y%a[k]!=0:
				f2=False
				break
		# print(f1,f2)
		if f1 and f2:
			print(x,y)
			exit()

import sys,math,string
input=sys.stdin.readline

L=lambda : list(map(int,input().split()))
Ls=lambda : list(input().split())
M=lambda : map(int,input().split())

n=int(input())
l=L()
l.sort()
k=l[-1]

i=1
while(i<=math.sqrt(k)):
    if(k%i==0):
        l.remove(i)
        if(i!=k//i):
            l.remove(k//i)
    i+=1
l.sort()
print(k,l[-1])

from math import gcd
N = int(input())
ar = [int(x) for x in input().split()]
ar.sort()
a = ar[-1]
br = []
for i in range(N):
	if i > 0 and ar[i] == ar[i - 1]:
		br.append(ar[i])
	else:
		if(a % ar[i] != 0):
			br.append(ar[i])
b = 1
for i in br:
	b = (b * int(i)) // gcd(b, i)
print(a, b)

import math

def getDivisors(n) :
    i = 1
    arr=[]
    while i <= math.sqrt(n):
        if (n % i == 0) :
            if (n / i == i) :
                arr.append(i)
            else :
                # Otherwise print both
                arr.append(i)
                arr.append(n/i)
        i=i + 1
    return arr

n=int(input())
arr=list(map(int,input().split()))
maxx=max(arr)
arr1=getDivisors(maxx)
d={}
for i in arr:
    if i in d.keys():
        d[i]+=1
    else:
        d[i]=1

for i in arr1:
    if d[i]==1:
        del d[i]
    else:
        d[i]=1

maxx1=max(list(d.keys()))
print(maxx,maxx1)

n = int(input())

l = list(map(int,input().split()))

l.sort()

x = l[-1]

hash = set()

k = []
for i in l:
    if x%i == 0 and i not in hash:
        # print(i)
        hash.add(i)

        # print(l)
    else:
        k.append(i)
# l.remove(x)

k.sort()
y = k[-1]
# print(l)
print(x,y)

q = int(input())
l = list(map(int, input().split()))
a = max(l)
print(a, end = " ")
for i in range(1, a + 1):
    if a % i == 0:
        l[l.index(i)] = -1
print(max(l))

n=int(input())
a=list(map(int,input().split()))
a=sorted(a)
x=a[-1]
y=0
div_x=list()
for i in range(n):
	if x%a[i]==0:
		if a[i] not in div_x:
			div_x.append(a[i])
dic={}
for i in a:
	if 	i in dic.keys():
		dic[i]+=1
	else:
		dic[i]=1
for i in div_x:
	dic[i]-=1
	if dic[i]==0:
		dic.pop(i)
y=max(dic.keys())
print(x,y)

n=int(input())
s=sorted(map(int,input().split()))
ans=s[-1]
for i in range(n-1,-1,-1):
    if ans%s[i]or s.count(s[i])>1:print(ans,s[i]);break

input()
l = sorted(map(int, input().split()))
b = max(l)
x = [i for i in l if b%i == 0]
for i in list(set(x)):
    l.remove(i)
print(b,max(l))

def gcd(a,b):
    if (b == 0):
     return a
    return gcd(b, a % b)

def findlcm(arr,n):
    ans = arr[0];
    for i in range(len(arr)):
        ans = (((arr[i] * ans)) / (gcd(arr[i], ans)))

    return int(ans)

n = int(input())
a = [int(i) for i in input().split()]
b=sorted(set(a),reverse=True)
x=b[0]
y = [i for i in b if (x%i!=0)]
if(len(y)==0):
    k=1
    c=[int(i) for i in b if (a.count(i)==2)]
    print(x,findlcm(c,len(c)))
else:
    print(x,y[0])

n=int(input())
divs=list(map(int,input().split()))
x=max(divs)
for i in range(1,x+1):
    if x%i==0: divs.remove(i)
print(x,max(divs))

# import sys
# sys.stdin=open("input.in",'r')
# sys.stdout=open("out1.out",'w')
n=int(input())
a=list(map(int,input().split()))
a.sort()
x=a[-1]
b=[]
i=0
while i<len(a):
	if a[i] not in b and x%a[i]==0:
		b.append(a[i])
		a.remove(a[i])
	else:
		i+=1
y=a[-1]
print(x,y)

def isPrime(n) :
    if (n <= 1) :
        return False
    if (n <= 3) :
        return True

    if (n % 2 == 0 or n % 3 == 0) :
        return False

    i = 5
    while(i * i <= n) :
        if (n % i == 0 or n % (i + 2) == 0) :
            return False
        i = i + 6

    return True

from itertools import combinations
from sys import stdin
import math

def listIn():
    return list((map(int,stdin.readline().strip().split())))

def stringIn():
    return([x for x in stdin.readline().split()])

def intIn():
    return (int(stdin.readline()))

n=intIn()
d=listIn()
lia=[]
lib=[]
di={}
for i in range(n):
    if d[i] not in di:
        di[d[i]]=1
    else:
        di[d[i]]+=1
d=sorted(set(d))
d=d[::-1]
n=len(d)
lia=[d[0]]
if len(set(di.values()))==1:
    print(max(d),max(d))
else:
    for i in range(n):
        if di[d[i]]==2:
            lia.append(d[i])
            lib.append(d[i])
        else:
            if lia[0]%d[i]==0:
                lia.append(d[i])
            else:
                lib.append(d[i])

    #print(lia,lib)
    print(max(lia),max(lib))

n=int(input())
a=list(map(int,input().split()))
h=[0]*20001
a.sort()
for i in range(n):
    h[a[i]]+=1
p=max(a)
fl=0
for i in range(1,20001):
    if p%i==0:
        h[i]-=1
for i in range(20001-1,1,-1):
    if h[i]>=1:
        ans=i
        fl=1
        break
if fl==0:
    ans=1
print(str(p)+" "+str(ans))

n = int(input())
s = list(map(int, input().split()))
x = max(s)
divisors = []
for i in range(1, x + 1):
	if x % i == 0:
		s.remove(i)
y = max(s)
print(x, y)

n = int(input())
s = [int(elem) for elem in input().split()]
a = 1
b = 1
x = max(s)
s2 = []
used = [False] * 10001
for i in range(n):
    if x % s[i] != 0 or used[s[i]]:
        s2.append(s[i])
    else:
        used[s[i]] = True
print(x, end=' ')
if len(s2) > 0:
    y = max(s2)
    print(y)
else:
    print(1)

n=int(input())
a=[int(i) for i in input().split()]
a.sort()
x,b,c,prod=max(a),[],[],0
for i in range(len(a)):
    if(x%a[i]!=0):
        b.append(a[i])
for i in range(1,len(a)):
    if(a[i]==a[i-1]):
        c.append(a[i])
#if(len(c)!=0):
 #   z=max(c)
#else:
 #   z=1
if(len(b)!=0):
    y=max(b)
else:
    y=max(c)
#t=y*z
print(x,y)

n=int(input())
l=list(map(int,input().split()))
m=max(l)
for i in range(1,m+1):
	if m%i==0:
		l.remove(i)
print(m,max(l))

n=int(input())
a=sorted(list(map(int,input().split())))
x=a[n-1];y=1
b=[0]*10001
for i in range(n):
    b[a[i]]+=1
for i in range(1,x+1):
    if x%i==0:
        b[i]-=1
for i in range(10000,-1,-1):
    if b[i]==1:
        y=i
        break
print(x,y)

n=int(input())
import math

# Method to print the divisors
def printDivisors(n) :
    k = []

    # List to store half of the divisors
    for i in range(1, int(math.sqrt(n) + 1)) :

        if (n % i == 0) :

            # Check if divisors are equal
            if (n // i == i) :
                k.append(i)
            else :
                k.append(i)
                k.append(int(n // i))
    return list(set(k))
c = list(map(int,input().split()))
c = sorted(c)
k =c[-1]
l = printDivisors(c[-1])
c.reverse()
for i in range(1,len(c)):
    if(sorted(printDivisors(c[i])+l) == sorted(c)):
        print(k,c[i])
        break

n=int(input())
l1=list(map(int,input().split()))
y=max(l1)
for i in range(1,y+1):
	if y%i==0:
		l1.remove(i)
print(y,max(l1))

n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
print(a[0], end=" ")
i = 1
while i < n:
    if a[i] == a[i - 1] or a[0] % a[i] != 0:
        print(a[i])
        break
    i += 1

n=int(input())
li=list(map(int,input().split()))
li.sort(reverse=True)
#print(li)
l=[]
for i in li:
	if li.count(i)==2:
		l.append(i)
l=list(set(l))
l.sort(reverse=True)
#print(l)
for i in li[1:]:
	if li[0]%i!=0:
		print(li[0],i)
		exit(0)
if li[0]%li[1]!=0:
	print(li[0],li[1])
elif len(l)==1:
	#li.sort(reverse=True)
	if li[0]%li[1]==0:
		print(1,max(li))
	else:
		print(li[0],li[1])
elif len(li)==4:
	#li.sort(reverse=True)
	print(li[0],li[1])
elif len(l)>=2:
	l.sort(reverse=True)
	print(l[0],max(li))
# else:
# 	for i in li:
# 		if i%l[0]==0 and i%l[1]==0 and i!=l[0] and i!=l[1]:
# 			print(i,end=" ")

n=int(input())
arr=list(map(int,input().split()))
x=max(arr)
for i in range(1,int(x**0.5)+1):
	if x%i==0:
		if x//i==i:
			arr.remove(i)
		else:
			arr.remove(i)
			arr.remove(x//i)
print(x,max(arr))

n = int(input())
l = list(map(int,input().split()))

x = max(l)

for i in range(1 , x + 1):
    if x % i == 0 :
        l.remove(i)

#print(l)
print(x , max(l))

n = input()
lst = sorted(map(int, raw_input().split()))
gr = lst[-1]

oth_idx = 1
for i in range(len(lst) - 1):
    tmp = lst[i]
    if gr % lst[i] == 0:
        i += 1
        if tmp == lst[i]:
            oth_idx = i
            i += 1
    else:
        oth_idx = i

print gr, lst[oth_idx]

from collections import deque
from math import ceil
import sys

# input = sys.stdin.buffer.readline
# def print(val):
# 	sys.stdout.write(str(val) + '\n')
# for _ in range(int(input())) :
n = int(input())
a = [int(i) for i  in input().split()]
a.sort(reverse=True)
x = a[0]
s = set()
for i in a.copy() :
	if x%i == 0 and not i in s :
		a.remove(i)
		s.add(i)
y = a[0]
print(x, y)

__author__ = 'tanunia'

import math

def all_divs(x):
    res = set()
    for i in xrange(1, int(math.sqrt(x)) + 1):
        if x % i == 0:
            res.add(i)
            res.add(x/i)
    return res

n = int(raw_input())
divs = sorted([int(x) for x in raw_input().split()])
y = divs[-1]
y_divs = all_divs(y)
for x in divs:
    x_divs = all_divs(x)
    xy_divs = []
    for c in y_divs:
        xy_divs.append(c)
    for c in x_divs:
        xy_divs.append(c)
    xy_divs = sorted(xy_divs)
    if divs == xy_divs:
        print x, y
        break

'''input
6
1 1 3 3 5 15
'''
from math import gcd
from sys import stdin
def myfunction():
	# I am a disco dancer
	# it is a copy code
	pass

n=int(stdin.readline().strip())
arr=list(map(int, stdin.readline().split()))
p=dict()
if n==2:
    print(arr[0],arr[1])
    exit()
for i in arr:
    if i in p:
        p[i]+=1
    else:
        p[i]=1
b=[]

for i in p:
    if p[i]==2:
        b.append(i)

arr.sort(reverse=True)

for i in range(1,n):
    if gcd(arr[i],arr[0]) in b:
        f_a = arr[0]
        f_b = arr[i]
        break
print(f_a,f_b)

import sys
import heapq
import bisect
import math
import random

INF = 10**9+7
OFFLINE = 0
N = 101010
sys.setrecursionlimit(INF)

def fi():
	return int(sys.stdin.readline())

def fi2():
	return map(int, sys.stdin.readline().split())

def fi3():
	return sys.stdin.readline().rstrip()

def fo(*args):
	for s in args:
		sys.stdout.write(str(s)+" ")
	sys.stdout.write("\n")

##
if OFFLINE:
	sys.stdin = open("fin.txt", "r")
	sys.stdout = open("fout.txt", "w")
##

##main

n = fi()

d  = fi2()
d.sort()

X = d[-1]

Y = None
for i in range(n-1):
	if X%d[i] == 0:
		continue

	else:
		Y = d[i]

if Y == None:
	for i in d:
		if d.count(i) == 2:
			Y = i

print X, Y

import sys
def deliteli(x):
    ret = []
    for i in xrange(1, int(x**0.5)+2):
        if x%i == 0:
            i2 = x/i
            if i2 > i:
                ret.extend([i, i2])
            elif i2 == i:
                ret.append(i)
    return ret

n = input()
data = map(int, raw_input().split())
data.sort()
m = data[-1]
for delitel in deliteli(m):
    data.pop(data.index(delitel))

print >> sys.stderr, data
print m, data[-1]

N = int(input())
arr = [int(i) for i in input().split()]
a = max(arr)
arr.remove(a)
b = max(arr)
print(a, end = " ")
if a == b:
    print(b)
else:
    r = len(arr)
    for i in range(r):
        b = max(arr)
        arr.remove(b)
        t = max(arr)
        if b == t:
            print(b)
            break
        elif a % b != 0:
            print(b)
            break
    else:
        print(1)

n=input()
c={}
for x in map(int,raw_input().split()):
    c[x]=c.get(x,0)+1
a=max(c)
for x in c:
    if 0==a%x:
        c[x]-=1
print a,max([x for x in c if c[x]])

n=int(input())
l=[int(j) for j in input().split()]
l.sort()
a=l[-1]

d=dict()
new=[]

for i in range(n):
    if a%l[i]==0 and not l[i] in d:
        d[l[i]]=1

    else:
        new.append(l[i])

g=new[-1]

print(a,g)

n=int(input())
a=[int(i) for i in input().split()]
a.sort()
x=a[-1]
past=0
for i in range(n):
    if(a[-1]%a[i]==0 and past!=a[i]):
        past=a[i]
        a[i]=0

a.sort()
print(x,a[-1])

n = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
ans = a[n-1]
for i in range(1,n):
    if a[0]%a[i] != 0 or a[i-1]==a[i]:
        ans = a[i]
        break
print(ans,a[0])

x=input()
y=list(map(int,input().strip().split()))
z=max(y)
y.remove(z)
for i in range(1,int(z/2)+1):
    if z%i==0:
        y.remove(i)
a=max(y)
print(z,a)

n = int(raw_input())
a = map(int, raw_input().split())

a.sort()
l = a[-1]
ans = 0

for i in range(n-2,-1,-1):
    if l % a[i] != 0:
        ans = a[i]
        break

if ans == 0:
    for i in range(n-2,-1,-1):
        if a[i] == a[i+1]:
            ans = a[i]
            break

print ans, l

t=int(input())
inar = list(map(int,input().split()))
x = max(inar)
xs=[]
ys=[]
for ina in inar:
    if inar.count(ina)==2:
        xs.append(ina)
        ys.append(ina)
    elif x%ina==0:
        xs.append(ina)
    else:
        ys.append(ina)
print('{} {}'.format(x,max(ys)))

count = int(input())
arr = [int(x) for x in input().split()]
a = max(arr)
b = 0
arr2 = set()
for i in range(len(arr)):
    if a % arr[i] != 0:
        arr2.add(arr[i])
    if arr.count(arr[i]) > 1:
        arr2.add(arr[i])
print(a, max(arr2))

#import sys

N = int(input())

P = list(map(int, input().split(" ")))

p = len(P)
num = max(P)

yakusuu_array = []

for i in range(1,num):

    if num % i == 0:
        yakusuu_array.append(i)

yakusuu_array.append(num)

m = len(yakusuu_array)
#set_ab = []
#set_ab = list(set(P) - set(yakusuu_array))

for j in range(m):
    d = yakusuu_array[j]
    P.remove(d)
    #print(P)

num1 = max(P)

print(int(num)," ",int(num1))

def arr_inp():
    return [int(x) for x in input().split()]

def factorize(n):  # o(sqr(n))
    c, ans, arr = 1, 0, deque([])
    while (c ** 2 < n):
        if n % c == 0:
            arr.extend([c, n // c])
        c += 1

    if c ** 2 == n:
        arr.append(c)
    return sorted(arr)

from collections import *
from math import *

n, d = int(input()), arr_inp()
d.sort()
x, p = d[-1], 0
x_fac, y = factorize(x), -1

for i in d:
    if p < len(x_fac) and x_fac[p] == i:
        p += 1
    else:
        y = max(y, i)

print(x, y)

n=int(input())
l=list(map(int, input().strip().split()))

a=max(l)

visited=[]

rr=[]

for i in l:
	if a%i==0 and i not in visited:
		visited.append(i)
	else:
		rr.append(i)
# print(rr)

b=max(rr)
print(a, b)

def ans(a):
    x = a.pop()
    save = {}
    if x == a[len(a)-1]:
        return [x,x]
    while a:
        y = a.pop()
        if x%y != 0 or y in save:
            break
        save[y] = 1
    return [x,y]

n = int(input())
a = [int(i) for i in input().split()]
a.sort()
print(*ans(a))

n = input()
l = map(int, raw_input().split())
tmp = max(l)
t2 = set(l)
for i in t2:
	if tmp%i == 0:
		l.remove(i)
print tmp, max(l)

n=int(input())

ll=[int(x) for x in input().split()]
# print(n)
# print(ll)
hset=set()
a=max(ll)
b=-1
for i in range(0,n):
    if(ll[i] in hset):
        b=max(b,ll[i])
    hset.add(ll[i])
    if(a%ll[i]!=0):
        b=max(b,ll[i])
if(b==-1):
    b=a
print(a,' ',b)

a = int(input())
b = [int(x) for x in input().split()]
b.sort(key = lambda x: -x)
x = b[0]
for m in range(1,x+1):
    if x%m == 0:
        b.remove(m)
print(x, b[0])

def factors(num):
    res = []
    for i in xrange(1,int(num**0.5)+1):
        if num%i == 0:
            res.append(i)
            if num/i != i:
                res.append(num/i)
    return res

n = input()
divisors = map(int, raw_input().split())
divisors.sort()

a = divisors[0] * divisors[n-1]
facts = factors(a)
for num in facts:
    divisors.remove(num)
b = min(divisors) * max(divisors)
print a,b

from collections import Counter
n = int(input())
arr = list(map(int,filter(None,input().split(' '))))
arr = sorted(arr)
def get_div(n):
    li = []
    for i in range(1,int(n/2)+1):
        if n%i==0:
            li.append(i)
    li.append(n)
    return li
n1 = arr[-1]
li2 = get_div(n1)
li3 = list((Counter(arr)-Counter(li2)).elements())
n2 = li3[-1]
print(n1,' ',n2)

n = int(input())
a = sorted(list(map(int,input().split())))[::-1]
x = a[0]
for i in range(n):
	if x%a[i] != 0:
		y = a[i]
		break
	elif a[i+1] == a[i]:
		y = a[i]
		break
print(x,y)

n = int(input())
a = list(map(int, input().split()))
a.sort()
mx = a[len(a)-1]
mx1 = 0
for i in range(n-1):

    if a[i] == mx:
        mx1 = mx
    if mx % a[i] or a[i] == a[i+1]:
        mx1 = max(mx1, a[i])
print(mx, max(1, mx1))

import sys
#sys.stdin=open("./pb3.txt","r")
raw_input=sys.stdin.readline

n=int(raw_input())
ar=map(int,raw_input().split())

ar.sort(reverse=True)
y=ar[0]
occ=[0]*(y+1)
for i in ar:
	occ[i]+=1

for i in xrange(1,n):
	if (y%ar[i]==0 and occ[ar[i]]==2) or y%ar[i]!=0:
		x=ar[i]
		break
print x,y

n = int(input())
d = sorted([int(i) for i in input().split()])[::-1]
x = [d[0]]
y = []
# if d[1] != x:
# 	for i in range(n):
# 		if d[i-1] == 1 and d[i] == 1:
# 			y = 1
# 			break
# 		if not x % d[i] == 0:
# 			y = d[i]
# 			break
for i in range(0, n):
	if d[i] == d[i-1]:
		y.append(d[i])
	elif x[0] % d[i] == 0:
		x.append(d[i])
	else:
		y.append(d[i])
d = sorted(d)[::-1]
x = sorted(x)[::-1][0]
y = sorted(y)[::-1][0]
print(x, y)

import math
n=int(input())
f=[]
l=list(map(int,input().split()))
x=max(l)
p=x
    #l.remove(x)

for i in range(len(l)):
    if p%l[i]==0:
        if l[i] not in f:
            f.append(l[i])

for i in f:
    l.remove(i)

y=max(l)
print(x,y)

N = input()
A = map(int, raw_input().split())
A.sort()

X = A[-1]
i = 1
B = []

while i * i <= X:
    if X % i == 0:
        if i * i == X:
            B.append(i)
        else:
            B.append(i)
            B.append(X / i)
    i += 1

B = set(B)

for i in xrange(N-1, -1, -1):
    if A[i] not in B:
        print X, A[i]
        exit()
    else:
        B.remove(A[i])

from math import sqrt
def div(n):
	s = set()
	for i in range(1,n):
		if n%i == 0:
			s.add(i)
	s.add(n)
	return s

n = input()
arr = map(int,raw_input().split())
arr.sort()
n1 = arr[-1]
z = div(n1)
for i in range(n):
	if arr[i] in z:
		z.remove(arr[i])
		arr[i] = 0
print max(arr),n1

n=int(input())
d=list(map(int,input().split()))
d.sort()
num1=d[n-1]
b=[]
for i in range(1,n):
    if(num1%d[i]!=0):
        b.append(d[i])
    else:
        if(d[i-1]==d[i]):
            b.append(d[i])
num2=b[len(b)-1]
print(num1,num2)

n = input()
from collections import Counter
d = Counter(map(int, raw_input().split()))

x = max(d)
print x,
for i in xrange(1,x+1):
  if x%i==0:
    d.subtract([i])
print max(d.elements())

from math import gcd

n = int(input())
A = list(map(int, input().split()))
answer = 1
a = max(A)
visited = set()
for i in range(n):
    if a % A[i] != 0 or A[i] in visited:
        answer *= (A[i] // gcd(A[i], answer))
    visited.add(A[i])
print(a, answer)

n=int(input())
d=list(map(int,input().split()))
d.sort()
m=max(d)
mm=1
for k in d:
	if d.count(k)>1 or m%k:
		mm=k
print(m,mm)

a=int(raw_input())

l=map(int,raw_input().split())

x=max(l)

for i in xrange(1,int(x**0.5)+1):
	if x%i==0:
		l.remove(i)
		if x/i != i:
			l.remove(x/i)

print str(x)+" "+str(max(l))

n = input()
list = map(int, raw_input().split())
list.sort()
list.reverse()
print list[0],
a=list[0]
arr=[]
for i in range(1,a+1):
    if a%i==0:
        arr.append(i)
for a in range(len(arr)):
    for b in range(n):
        if list[b]==arr[a]:
            list[b]=0
            break
list.sort()
list.reverse()
print list[0]

n = int(input())
l = list(map(int, input().split()))
l.sort()
a=l[-1]
b=1
for i in range(n-2,-1,-1):
    if(l[i]==l[i+1]):
        b=l[i]
        break
    if(a%l[i]!=0):
        b=l[i]
        break
print(a,b)

n=int(input())
a=list(map(int,input().split()))
a.sort()
#print(a)
x=max(a)
y=0
d={}
for i in range(n):
    if a[i] in d:
        d[a[i]]+=1
    else:
        d[a[i]]=1
for i in range(n-2,-1,-1):
    if x%a[i]!=0:
        y=a[i]
        break
    elif x%a[i]==0 and d[a[i]]>1:
        y=a[i]
        break
if y==0:
    if d[x]>=2:
        y=x
    else:
        y=1
print(x,y)

#usefull:
#1.Ways to find duplicate elements
#2.

n = int(input())
divisors = [ int(x) for x in input().split()]

def hcf(a,b):
    while(a!=b):
        if(a>b): a=a-b
        else: b = b-a
    return a

def lcm(a,b):
    h = hcf(a,b)
    return (a*b)//h

div = sorted(divisors)
a=div[-1]
b=1

for i,x in enumerate(div):
    if( x== div[i-1] or a%x!=0):
        b = max(b,x)
        #b = lcm(b,x)

print(a,b)

n = int(input())
lista = [int(x) for x in input().split()]
maxi = 0
id = 0
for i in range (0, len(lista)):
  if maxi<lista[i]:
    maxi = lista[i]
    id = i
lista[id] = -1
another = []
another.append(maxi)

print(maxi, end=' ')

maxi2 = -1
for i in range (0, len(lista)):
  if maxi%lista[i]==0 and (lista[i] not in another):
  	another.append(lista[i])
  	lista[i] = -1

maxi2 = max(lista)
if maxi2 == -1:
	print(maxi)
else:
	print(maxi2)

x = int(input())
y = map(int,input().split())
y = sorted(list(y))
f = y[-1]
l = []
f_d = [y[-1]]
for i in range(len(y)-1):
	if f%y[i] == 0 and (y[i] not in f_d):
		f_d.append(y[i])
		continue
	l.append(y[i])
print(f,max(l))

n=int(input())
arr=list(map(int,input().split()))
mx=max(arr)

div=[]
for i in arr:
    if(mx%i or arr.count(i)>1):
        div.append(i)

print(str(mx)+" "+str(max(div)))

n=input()
a=map(int,raw_input().split())
x=max(a)
print x,
z=[]
y=[]
for i in a:
    if x%i==0:
        if i not in z:
            z.append(i)
        else:
            y.append(i)
    else:
        y.append(i)
print max(y)

import math

n = input()
num = map(int, raw_input().split())
num.sort()
num1 = num[-1]
for x in range(1, int(math.sqrt(num1) + 1)):
    if num1 % x == 0 and num1/x != x:
        num.remove(x)
        num.remove(num1/x)
    elif num1 % x == 0:
        num.remove(x)
num.sort()
num2 = num[-1]
print num1, num2

n=input()
l=map(int,raw_input().split())
l.sort()
a=l[n-1]
d=[]
def bsa(x,a,c):
    l=0; r=c-1
    while l<=r:
        m=(l+r)/2
        if a[m]==x:
            return True
        elif a[m]>x:
            r=m-1
        else:
            l=m+1
    return False
for i in range(1,int(a**(0.5))+1):
    if a%i==0:
        if a/i==i:
            d+=[i]
        else:
            d=d+[i,a/i]
d.sort()
c=len(d)
for j in range(n-1,-1,-1):
    if bsa(l[j],d,c) and l[j-1]<>l[j]:
        continue
    else:
        b=l[j]
        break
print a,b

n=int(input());a=sorted(list(map(int,input().split())));s=a[-1]
if a.count(a[-1])==2:print(a[-1],a[-1]);exit()

for i in range(len(a)-1,-1,-1):
    if s%a[i]!=0 or i==0 or a.count(int(a[i]))==2:print(s,a[i]);exit()

from sys import stdin
from math import sqrt
###############################################################
def iinput(): return int(stdin.readline())
def sinput(): return input()
def minput(): return map(int, stdin.readline().split())
def linput(): return list(map(int, stdin.readline().split()))
###############################################################

n = iinput()
a = linput()
y = max(a)
i = 0
for i in range(1, int(sqrt(y))+1):
    if y%i == 0:
        try: a.remove(i)
        except: pass
        try:
            if i!=y//i: a.remove(y//i)
        except: pass
x = max(a)
print(x, y)

n = input()
arr = map(int,raw_input().split())
arr.sort()
x = arr[-1]
temp = arr[0]
y = []
for i in range(1,n):
    if temp==arr[i]:
        y.append(arr[i])
        temp = arr[i]
    else:
        if x%arr[i]!=0:
            y.append(arr[i])
            temp = arr[i]
        else:
            temp = arr[i]

print x,max(y)

if __name__ == '__main__':
    n = int(input())
    l = map(int, raw_input().rstrip().split())
    if n == 2:
        print "1 1"
    else:
        l = sorted(l)
        ma = l[-1]
        i=0
        flag = True
        while flag:
            if l[i] == l[i+1]:
                del(l[i])
                i += 1
            elif ma % l[i] == 0:
                del(l[i])
            else:
                i += 1
            flag = l[i] != ma
        mi = l[-2]
        print str(mi) + " " + str(ma)

if __name__ == "__main__":
    n = int(input())
    numbers = list(map(int, input().split()))
    numbers.sort(reverse = True)
    num1 = numbers[0]
    div_num1 = set()
    for val in numbers:
        if num1 % val == 0:
            div_num1.add(val)

    for val in div_num1:
        numbers.remove(val)

    if len(numbers) == 0:
        num2 = num1
    else:
        numbers.sort(reverse = True)
        num2 = numbers[0]

    print(num1, num2)

n = int(raw_input())
arr = list(map(int,raw_input().split()))

ma = max(arr)

ans = []
if arr.count(ma) == 2:
    ans = [ma,ma]
else:
    ans.append(ma)
    d = dict()
    for i in arr:
        d[i] = d.get(i,0) + 1
    for i in d.keys():
        if ma%i == 0:
            d[i] -= 1
    temp = []
    for i in d.keys():
        if d[i]:
            temp.append(i)
    ans.append(max(temp))

print(" ".join(map(str,ans)))

n=int(input())
d=list(map(int,input().split()))
m=max(d)
k=0
for i in d:
    if (m%i!=0 or d.count(i)>1) and i>k:
        k=i
print(m,k)

import sys

n = raw_input()
l = [0 for _ in range(10080)]

for x in sorted(map(int, raw_input().split())):
    l[x] += 1
    y=x
for x in range(1,10001):
    if y%x == 0 and l[x]:
        l[x] -= 1
    if l[x]:
        oe = x
print y, oe

n=input()

a=map(int,raw_input().split())

ans=max(a)

for i in range(1,ans+1):

    if ans%i==0:

        a.remove(i)

print ans,max(a)

n = int(raw_input())
l = [int(i) for i in raw_input().split()]
l = sorted(l)
# print l
a = []
m = l[-1]
for i in range(1 , m+1):
  if  m % i == 0:
    l.remove(i)

print m , l[-1]

def solve():
    input()
    ar = []
    for i in (input().split(' ')):
        if i.isdigit():
            ar.append(int(i))
    ar.sort()
    x = ar[-1]
    ary = []
    deleted = 0
    for i in ar:
        if (x % i != 0) or (i == deleted):
            ary.append(i)
        else:
            deleted = i
    y = ary[-1]
    print(x ,y)

solve()

t=int(raw_input())
a=map(int,raw_input().split())
a.sort()
x=a[-1]
c=set([])
for i in range(1,int(x**0.5)+2):
	if(x%i==0):
		c.add(i)
		c.add(x/i)
c=sorted(list(c))
d1=[0]*(10**4+5)
for i in a:
	d1[i]=d1[i]+1
y=1
for i in c:
	d1[i]=d1[i]-1
y=-1
for i in range(len(d1)):
	if d1[i]==1:
		y=max(y,i)
print x,y

n = int(input())
a = list(map(int, input().split()))
b = [0] * 10001
for i in range(n):
    b[a[i]] += 1
a = sorted(set(a))
a = list(a)
if b[a[len(a) - 1]] == 2:
    start = len(a) - 1
else:
    start = len(a) - 2
for i in range(start, -1, -1):
    c = b.copy()
    for j in a:
        if a[len(a) - 1] % j == 0:
            c[j] -= 1
        if a[i] % j == 0:
            c[j] -= 1
        if c[j] < 0:
            break
    good = True
    for j in c:
        if j != 0:
            good = False
            break
    if good:
        print(a[len(a) - 1], a[i])
        break

n = int(input())
a = list(map(int, input().split()))
ch1 = max(a)
nums = set()
for i in range(len(a)):
    if (ch1 % a[i] == 0) and (a[i] not in nums) and (a[i] != -1):
        nums.add(a[i])
        a[i] = -1
print(ch1, max(a))

n=int(input())
l=list(map(int,input().split()))
l.sort()
t=0
for i in range(n-1):
    if l[i]==l[i+1]:
        t=max(t,l[i])
a=l[-1]
b=0
for i in range(n):
    if l[i]%t==0 and l[i]!=a:
        b=max(b,l[i])
print(a,b)

n = input()
list = map(int, raw_input().split())
list.sort()
list.reverse()
print list[0],
a=list[0]
for i in range(n):
    if a%list[i]==0:
        list[i]=0
list.sort()
list.reverse()
if list[0]!=0:
    print 0
else:
    print 1

n=int(input())
li=list(map(int,input().split()))
li.sort(reverse=True)
#print(li)
l=[]
for i in li:
	if li.count(i)==2:
		l.append(i)
l=list(set(l))
l.sort(reverse=True)
#print(l)
if li[0]%li[1]!=0:
	print(li[0],li[1])
elif len(l)==1:
	#li.sort(reverse=True)
	if li[0]%li[1]==0:
		print(1,max(li))
	else:
		print(li[0],li[1])
elif len(li)==4:
	#li.sort(reverse=True)
	print(li[0],li[1])
elif len(l)>3:
	l.sort(reverse=True)
	print(l[0],max(li))
else:
	for i in li:
		if i%l[0]==0 and i%l[1]==0 and i!=l[0] and i!=l[1]:
			print(i,end=" ")

input()
*l,=sorted(map(int,input().split()))
f=l[-1]
d = {i:l.count(i) for i in set(l)-{f}}
if 1 not in d.values():
	print(f,f)
else:
	for i in range(1,f//2+1):
		if not f%i:d[i]-=1
	d={i:d[i] for i in d.keys() if d[i]}
	print(f,max(d.keys()))

n=int(input())

ll=[int(x) for x in input().split()]
# print(n)
# print(ll)
hset=set()
a=max(ll)
b=-1
for i in range(0,n):
    if(ll[i] in hset):
        b=max(b,ll[i])
    elif(a%ll[i]!=0):
        b=max(b,ll[i])
if(b==-1):
    b=a
print(a,' ',b)

x=int(input())
y=input().split()
z=[]
t=[]
if x==2:
    print(int(y[0]),int(y[1]))
else:
    for i in y:
        z.append(int(i))
    f=max(z)

    z.remove(z[z.index(f)])
    for i in z:
        if f % i != 0:
            t.append(i)
    if len(t) == 0:
        f2=max(z)
    else:
        f2=max(t)

    print(f,f2)

def get_factors(num):
    l = [1,num]
    for i in range(2,int(num**0.5) + 1):
        if not num%i:
            if i not in l:
                l.append(i)
                l.append(num//i)
    return(l)
n = int(input())
l = list(map(int, input().rstrip().split(" ")))
l.sort()
n1 = max(l)
print(n1, end= " ")
fac_n1 = get_factors(n1)
fac_n1.sort()
f = len(fac_n1)
b=0
for i in range(n):
    if l[i]==fac_n1[b]:
        l[i]=0
        b=b+1
    if b >= f:
        break
print(max(l))

def nok(a,b):
    return a*b/nod(a,b)
def nod(f,g):
    f,g=max(f,g),min(f,g)
    while f%g!=0:
        f=f%g
        f,g=g,f
    return g
n=int(input())
deli=list(map(int, input().split()))
p,v=1,1
deli.sort()
deli.append(0)
i=0
while i<n:
    if deli[i]==deli[i+1]:
        p=nok(p,deli[i])
        v=nok(v,deli[i])
        i+=2
    else:
        if deli[i]%v==0:
            v=nok(v,deli[i])
            i+=1
        else:
            p=nok(p,deli[i])
            i+=1
print(int(p),int(v))

from math import gcd
def lcm(x, y):
	return x * y // gcd(x, y)

n = int(input())
arr = list(map(int, input().split()))
a = max(arr)
arr.remove(a)
b = 0
for e in arr:
	if a % e:
		b = max(b, e)
print(a, b)

x = int(input())
y = map(int,input().split())
count = 0
y = sorted(list(y))
print(y[-1],y[-2])

from functools import reduce
from math import sqrt

def factors(n):
    step = 2 if n % 2 else 1
    return set(reduce(list.__add__,
                      ([i, n // i] for i in range(1, int(sqrt(n)) + 1, step) if n % i == 0)))
q=int(input())
ar=list(map(int,input().split()))
a=max(ar)
d=list(factors(a))
for t in ar:
    if t in d:
        ar.remove(t)
b=max(ar)
print(str(a)+" "+str(b))

n=int(input())
divs=list(map(int,input().split()))
x=max(divs)
ydivs=[i for i in divs if x % i != 0]
print(x,max(ydivs) if len(ydivs)!=0 else x)

q = int(input())
l = list(map(int, input().split()))
a = max(l)
if l.count(a) > 1:
    print(a, a)
    exit(0)
ll = [0]
for i in range(q):
    if a % l[i] != 0:
        ll += [l[i]]
print(a, max(ll))

n=int(input())
g=[int(g) for g in input().split()]
g.sort()
l=[]
for i in reversed(g):
    if g[-1]%i!=0:
        l.append(i)
        break
if l==[]:
    print(g[-1],g[-2])
else:
    print(g[-1],l[0])

#	!/usr/bin/env python3
#	coding: UTF-8
#	Modified: <23/Jan/2019 08:24:27 PM>

#	✪ H4WK3yE乡
#	Mohd. Farhan Tahir
#	Indian Institute Of Information Technology (IIIT),Gwalior

#	Question Link
#
#

# ///==========Libraries, Constants and Functions=============///

import sys

inf = float("inf")
mod = 1000000007

def get_array(): return list(map(int, sys.stdin.readline().split()))

def get_ints(): return map(int, sys.stdin.readline().split())

def input(): return sys.stdin.readline()

# ///==========MAIN=============///

def main():
    n = int(input())
    arr = get_array()
    arr.sort()
    x = arr[-1]
    new_arr = []
    for i in range(n):
        if x % arr[i] != 0:
            new_arr.append(arr[i])
    if len(new_arr) == 0:
        print(x, x)
        return
    new_arr.sort()
    print(x, new_arr[-1])

if __name__ == "__main__":
    main()

a=int(input())
b=list(map(int,input().split()))
c=max(b)
b.sort()
for x in range(a-1,-1,-1):
	if c%b[x]!=0:
		break
	else:
		pass
print(c,b[x])

n =     input()

nums = []
nums = list(map(int, input().split()))

x = nums[0]
for num in nums:
    if(num>x):
        x = num;

nums.remove(x)
for num in nums:
    if (num % x != 0):
        y = num
        break;
print(y)
for num in nums:
    if num == x or (x % num != 0 and num > y):
        y = num;
print(x, y)

n=int(input())
a=list(map(int,input().split()))
s=max(a)
for i in range(len(a)):
    if s%a[i]==0:
        a[i]=0
b=max(a)
print(s,b)

n = input()
n = [int(i) for i in input().split()]
a = max(n)
if n.count(a) == 2:
  print(a, a)
elif set(filter(lambda x: max(n) % x != 0, n)) == set():
  print(a, 1)
else:
  print(a, max(set(filter(lambda x: a % x != 0, n))))

if __name__ == "__main__":
    n = int(input())
    numbers = list(map(int, input().split()))
    numbers.sort(reverse = True)
    num1 = numbers[0]
    num2 = None
    for val in numbers[1:]:
        if num1 % val != 0:
            num2 = val
            break

    if not num2:
        num2 = num1
    print(num1, num2, end = '')

n=int(input())
a=input().split()
mn = -1
min=-1
b=[]
sum=0
for i in a:
    if int(i)>mn:
        mn=int(i)
j=-1
for i in a:
    if int(i)==mn:
        if sum==0:
            b.append(1)
            sum+=1
        else:
            b.append(0)
    else:
        b.append(0)
for i in a:
    j+=1
    if(b[j]==1):
        continue
    if min<int(i):
        min=int(i)
print(str(mn)+' '+str(min))

n=int(input())
g=[int(g) for g in input().split()]
g.sort()
l=[]
op=[]
for i in reversed(g):
    if g[-1]%i!=0:
        l.append(i)
        break
if l==[]:
    if g[-1]!=g[-2]:
        op.append(g[-1])
        op.append(g[-2])
    else:
        op.append(g[-1])
        op.append(g[-3])
else:
    op.append(g[-1])
    op.append(i)
print(op[0],op[1])

n=int(input())
l=list(map(int,input().split()))
l.sort()
if l[-1]==l[-2]:
    print(l[-1],l[-2])
else:
    l.sort(reverse=True)
    for i in range(n):
        if l[0]%l[i]!=0:
            print(l[i],l[0])
            break
    else:
        print(l[0],l[-1])

z,w,m=input,int,sorted
n=int(z())
l=list(set(map(int,z().split())))
f=max(l)
l.remove(f)
print(f,max(l))

def solve():
    input()
    ar = []
    for i in (input().split(' ')):
        if i.isdigit():
            ar.append(int(i))
    print(ar)
    ar.sort()
    x = ar[-1]
    ary = []
    for i in ar:
        if x % i != 0:
            ary.append(i)
    y = ary[-1]
    print(x,' ',y)

solve()

def check(st1, st):
    res = 0
    for i in range(len(st)):
        if st[i] != st1[i%3]:
            res += 1
    return res
n = int(input())
s = str(input())
colors = ['RGB', 'RBG', 'BGR', 'BRG', 'GRB', 'GBR']
mn = int(n+1)
for x in range(6):
    mn = min(mn, check(colors[x], s))
print(mn)

for it in colors:
    if check(it, s) == mn:
        st = 0
        while st < n:
            print(it[st%3], end = '')
            st += 1
        break;

#####################################

# import libraries for input/ output handling
# on generic level
import sys

# use this for interactive problems
def fprint(x):
    print(x, flush=True)

# using this print for fast
def qprint(x):
    sys.stdout.write(str(x) + "\n")

# using this input
def input():
    return sys.stdin.readline()

#####################################
# code below
import collections
def lcm(x, y):
   if x > y:
       greater = x
   else:
       greater = y

   return greater

n = int(input())

list_div = list(map(int, input().split()))
list_fir = []
list_sec = []

for item, count in collections.Counter(list_div).items():
    if count == 1:
        list_fir.append(item)
    else:
        list_fir.append(item)
        list_sec.append(item)

first_num = 1
second_num = 1

for num in list_fir:
    if first_num % num == 0 or num % first_num == 0:
        first_num = lcm(first_num, num)
    else:
        list_sec.append(num)

for num in list_sec:
    second_num = lcm(second_num, num)

print(str(first_num) + " " + str(second_num))

n = int(input())
a = list(map(int, input().split()))
a.sort(reverse = True)
fl = False
k1 = 0
k2 = 0
s = set(a)
for i in range(len(a)):
  for j in range(len(a)):
    used = [False] * n
    for t in range(len(a)):
      if ((a[i] % a[t]) == 0) and (used[t] == False):
        k1 += 1
        used[t] = True
    for t in range(len(a)):
      if ((a[j] % a[t]) == 0) and (used[t] == False):
        k2 += 1
        used[t] = True
    if k1 + k2 == len(a):
      print(a[i], a[j])
      #print(k1, k2)
      fl = True
      break
    else:
      k1 = 0
      k2 = 0
  if fl == True:
    break

n=int(input())
l=list(map(int,input().split()))
l.sort()
le=len(l)
if l[le-1]%l[le-2]== 0:
    for i in range(le-1,0,-1):
        if l[le-1]%l[i]!=0:
            print(l[le-1],' ',l[i])
            break
else:
    print(l[le-1],' ',l[le-2])

from fractions import gcd
from math import factorial, ceil, sqrt, atan2, log, pi, e, asin,acos, cos, sin, floor, atan
from itertools import *
from fractions import Fraction
import string
import copy
import random
import bisect
from decimal import *
from collections import deque
from sys import *
digs = string.digits + string.ascii_letters

def id_generator(size=20, chars=string.digits):
    return ''.join(random.choice(chars) for _ in range(size))

def mp():
    return map(int,str(raw_input()).strip().split())

clear=stdout.flush()

n=input()
l=list(mp())
l.sort()
x=l[-1]
i=n-1
while i>0:
	if l[i]==l[i-1]:
		print x,l[i]
		exit()
	else:
		if l[i]%l[i-1]==0:
			pass
		else:
			print x,l[i-1]
			exit()
	i-=1

import math
def lcm(a,b):
    return (a*b) / math.gcd(a,b)
n = int(input())
l = list(list(map(int, input().split())))
l = sorted(l)
one_element = l[-1]
doubles = []
#print(doubles)
for i in l:
    #print(i, list(filter(lambda x: x==i, l)), len(list(filter(lambda x: x==i, l)))>1)
    if len(list(filter(lambda x: x==i, l)))>1:
        #print("in", i)
        if i not in doubles:
            #print(i)
            doubles.append(i)
#print(doubles)
sec = 1
for a in doubles:
    sec = lcm(int(a), int(sec))
def find(e, l):
    if e==1:
        return 1
    ans = list(filter(lambda x: x%e==0, l))
    return sorted(ans)[-2]
print( one_element  ,find(sec, l) )

def solve(n, values):
    values = sorted(values, reverse=True)
    x = values[0]
    index = 1
    while index < n and (x % values[index]) == 0:
        index += 1
    if index < n:
        return x, values[index]
    return x, x

n = int(input())
values = list(map(int, input().strip().split(' ')))
x, y = solve(n, values)
print('{} {}'.format(x, y))

n = int(input())
arr = list(map(int,input().strip().split(" ")))

arr.sort(reverse = True)
i = arr[0]
for j in arr:
	if(i%j):
		print(i,j)
		break

n=int(input())
a=list(map(int,input().split()))
x=max(a)
for i in range(0,n-1,2):
    if(a[i]*a[i+1]!=x):
        y=a[i]*a[i+1]
print(x,y)

from functools import reduce

if __name__ == '__main__':
    n = int(input())
    d = list(map(int, input().split()))
    d.sort(reverse=True)
    m = d[0]
    good = []
    bad = []
    for i in d[1:]:
        if m % i == 0:
            m //= i
            bad.append(i)
        else:
            good.append(i)

    fine = False
    for i in good[1:]:
        if good[0] % i != 0:
            fine = True
            break

    if fine:
        print(d[0], reduce(lambda x, acc: x*acc, good, 1))
    else:
        print(d[0], good[0])

n=int(input());a=sorted(list(map(int,input().split())));s=a[-1]
if a.count(a[-1])==2:print(a[-1],a[-1]);exit()
for i in range(len(a)-1,-1,-1):
    if s%a[i]!=0:print(s,a[i]);exit()

import sys

nb_test = 0

idx = 0
for line in sys.stdin:
    if idx != 0:
        list_divisors = map(int, line.strip().split(" "))
        a, b = list_divisors[0], list_divisors[1]
        a, b = (b, a) if a > b else (a, b)

        for d in list_divisors[2:]:
            if d >= b:
                if d % b == 0:
                    b = d
                elif d % a == 0:
                    a = d

                a, b = (b, a) if a > b  else (a, b)
            else:
                if d >= a:
                    if d % a == 0:
                        a = d

        sys.stdout.write("%d %d\n" % (a, b))
    idx += 1

n = int(input())
mas = list(map(int, input().split()))
x = max(mas)
mas.remove(x)
new_mas = [1]
for r in mas:
    if x % r != 0:
        new_mas.append(r)
y = max(new_mas)
print(x, y)

#	!/usr/bin/env python3
#	coding: UTF-8
#	Modified: <23/Jan/2019 08:13:00 PM>

#	✪ H4WK3yE乡
#	Mohd. Farhan Tahir
#	Indian Institute Of Information Technology (IIIT),Gwalior

#	Question Link
#
#

# ///==========Libraries, Constants and Functions=============///

import sys

inf = float("inf")
mod = 1000000007

def get_array(): return list(map(int, sys.stdin.readline().split()))

def get_ints(): return map(int, sys.stdin.readline().split())

def input(): return sys.stdin.readline()

# ///==========MAIN=============///

def main():
    n = int(input())
    arr = get_array()
    from collections import Counter
    count = Counter(arr)
    x, y = 1, 1
    for i in count:
        if count[i] == 2:
            x *= i
            y *= i
        else:
            x *= i
    print(x, y)

if __name__ == "__main__":
    main()

def gcd(a, b):
    if a == 0 :
        return b

    return gcd(b%a, a)
n=int(raw_input())
a=list(map(int,raw_input().split()))
print a
for i in xrange(n-2,0,-1):
    if a[-1] % a[i]!= 0:
        print a[-1],a[i]
        break

n = int(input())
divisiors = list(map(int, input().split()))

divisiors.sort()

x = divisiors[-1]

divisorY = list()

divisorY.append(1)

for i in divisiors:
    if x % i != 0 :
        divisorY.append(i)

divisorY.sort()

y = divisorY[-1]

print(x, y)

import math
n=int(input())
l=list(map(int,input().split()))
l.sort()
a=l[-1]
for i in range(n):
    if a%l[i]==0:
        l[i]=0
l.sort()
b=l[-1]
if (b==0):
    b=1
print(a,b)

n=int(input())
a=input().split()
mn = -1
min=-1
for i in a:
    if int(i)>mn:
        mn=int(i)
for i in a:
    if int(i) == mn:
        continue
    if mn%int(i)==0:
        continue
    if min<int(i):
        min=int(i)
print(str(mn)+' '+str(min))

from functools import reduce

if __name__ == '__main__':
    n = int(input())
    d = list(map(int, input().split()))
    m = n // 2
    print(reduce(lambda x, acc: x*acc, d[:m], 1), reduce(lambda x, acc: x*acc, d[m:], 1))

n=int(input())
l=list(map(int,input().split()))
l.sort()
t=0
for i in range(n-1):
    if l[i]==l[i+1]:
        t=max(t,l[i])
a=l[-1]
b=0
for i in range(n):
    if l[i]%t==0 and l[i]!=a:
        b=max(b,l[i])
if b==0:
    b=a
print(a,b)

n=int(input())
li=list(map(int,input().split()))
li.sort(reverse=True)
#print(li)
l=[]
for i in li:
	if li.count(i)==2:
		l.append(i)
l=list(set(l))
l.sort(reverse=True)
#print(l)
for i in li[1:]:
	if li[0]%i!=0:
		print(li[0],i)
		exit(0)
if li[0]%li[1]!=0:
	print(li[0],li[1])
elif len(l)==1:
	#li.sort(reverse=True)
	if li[0]%li[1]==0:
		print(1,max(li))
	else:
		print(li[0],li[1])
elif len(li)==4:
	#li.sort(reverse=True)
	print(li[0],li[1])
elif len(l)>3:
	l.sort(reverse=True)
	print(l[0],max(li))
else:
	for i in li:
		if i%l[0]==0 and i%l[1]==0 and i!=l[0] and i!=l[1]:
			print(i,end=" ")

n = int(input())
mas = list(map(int, input().split()))
x = max(mas)
mas.remove(x)
new_mas = []
a = set()
for r in mas:
    if x % r == 0 and r not in a:
        a.add(r)
    elif x % r == 0 and r in a:
        new_mas.append(r)
    else:
        new_mas.append(r)
y = max(new_mas)
print(x, y)

x = int(input())
y = map(int,input().split())
y = sorted(list(y))
f = y[-1]
l = []
for i in range(len(y)):
	if f%y[i] != 0:
		l.append(y[i])
print(f,max(l) if l != [] else y[-2])

n = int(raw_input())
l = [int(i) for i in raw_input().split()]
d = {}
for i in l:
  if i not in d:
    d[i] = 1
  else:
    d[i] += 1
# print d
l = sorted(l)
# print l
m = []
for i , j in d.items():
  if j == 2:
    m.append(i)
# print m
s = max(m)
if len(m) == 1:
  x = s
  ind = l.index(s)
  for i in range(ind+1, len(l)):
    if l[i] % s == 0:
      y = l[i]
  print x , y
else:

  ind = l.index(s)
  ind += 1
  # print ind
  x , y = 0 , 0
  flag = False
  for i in range(ind+1 , len(l)-1):
    if l[i] % s == 0 :
      x = l[i]
      for j in range(i+1 , len(l)):
        if l[j] % s == 0:
          y = l[j]

  if x == 0 and y == 0:
    x = s
    y = l[len(l) - 1]
    print x , y
  else:
    print x , y

N = int(input())
ar = [int(x) for x in input().split()]
a = 1
b = 1
i = 0
ar.sort()
while i < N:
	if i > 0 and ar[i - 1] == ar[i]:
		b = b * ar[i]
	else:
		a = a * ar[i]
	i += 1

print(a, b)

import math
def finddivisors(num):
    divisors=[]
    i=1
    while i**2<=num:
        if math.sqrt(num)==i:
            divisors.append(i)
        elif num%i==0:
            divisors.append(i)
            divisors.append(int(num/i))
        i+=1
    divisors.sort()
    return divisors
n=int(input())
d=list(map(int,input().split()))
d.sort()
x=d[-1]
a=finddivisors(x)
a=list(set(d)-set(a))
a.sort()
if len(a)==0:
    a=[1]
y=a[-1]
print(x,y)

n = int(raw_input())
l = map(int, raw_input().split())
x = max(l)
removidos = [False]*(x+1)
removidos[x] = True
l.remove(x)
for i in l:
    if not removidos[i] and x%i==0:
        l.remove(i)
        removidos[i] = True
y = max(l)
print x,y

"""Template for Python Competitive Programmers prepared by pa.n.ik, kabeer seth and Mayank Chaudhary """

# to use the print and division function of Python3
from __future__ import division, print_function

"""value of mod"""
MOD = 998244353
mod = 10**9 + 7

"""use resource"""
# import resource
# resource.setrlimit(resource.RLIMIT_STACK, [0x100000000, resource.RLIM_INFINITY])

"""for factorial"""

def prepare_factorial():
    fact = [1]
    for i in range(1, 100005):
        fact.append((fact[-1] * i) % mod)
    ifact = [0] * 100005
    ifact[100004] = pow(fact[100004], mod - 2, mod)
    for i in range(100004, 0, -1):
        ifact[i - 1] = (i * ifact[i]) % mod
    return fact, ifact

"""uncomment next 4 lines while doing recursion based question"""
# import threading
# threading.stack_size(1<<27)
import sys
# sys.setrecursionlimit(10000)

"""uncomment modules according to your need"""
from bisect import bisect_left, bisect_right, insort
# from itertools import repeat
from math import floor, ceil, sqrt, degrees, atan, pi, log, sin, radians
from heapq import heappop, heapify, heappush
# from random import randint as rn
# from Queue import Queue as Q
from collections import Counter, defaultdict, deque
# from copy import deepcopy
# from decimal import *
# import re
# import operator

def modinv(n, p):
    return pow(n, p - 2, p)

def ncr(n, r, fact, ifact):    # for using this uncomment the lines calculating fact and ifact
    t = (fact[n] * (ifact[r] * ifact[n-r]) % mod) % mod
    return t

def intarray(): return map(int, sys.stdin.readline().strip().split())
def array(): return list(map(int, sys.stdin.readline().strip().split()))
def input(): return sys.stdin.readline().strip()

"""*****************************************************************************************"""

def GCD(x, y):
    while y:
        x, y = y, x % y
    return x

def lcm(x, y):
    return (x * y)//(GCD(x, y))

def get_xor(n):
    return [n, 1, n+1, 0][n % 4]

def fast_expo(a, b):
    res = 1
    while b:
        if b&1:
            res = (res * a)
            res %= MOD
            b -= 1
        else:
            a = (a* a)
            a %= MOD
            b>>=1
    res %= MOD
    return res

def get_n(P):    # this function returns the maximum n for which Summation(n) <= Sum

    ans = (-1 + sqrt(1 + 8*P))//2
    return ans

""" ********************************************************************************************* """
""""
 array() # for araay
 intarray() # for map array
  yha pe SAMPLE INPUT
7
1 2 4 8 16 1 2

"""
""" OM SAI RAM """
def finddivisor(m,d):
    #print(ceil(sqrt(m))+1)
    for i in range(1,ceil(sqrt(m))):
        if m%i==0:
            d[i]-=1
            if i==m//i:
                continue
            else:
                d[m//i]-=1

def solve():
    n = int(input())
    a= array()
    d = defaultdict(int)
    for i in a:
        d[i]+=1
    m  = max(a)
    finddivisor(m,d)
    maxi = 0
    for i in d.keys():
        if d[i]>0:
            maxi = max(maxi,i)
    print(m,maxi)

    return

def main():
    T = 1
    while T:
        solve()
        T -= 1

"""OM SAI RAM """
""" -------- Python 2 and 3 footer by Pajenegod and c1729 ---------"""

py2 = round(0.5)
if py2:
    from future_builtins import ascii, filter, hex, map, oct, zip
    range = xrange

import os, sys
from io import IOBase, BytesIO

BUFSIZE = 8192

class FastIO(BytesIO):
    newlines = 0

    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        while self._fill(): pass
        return super(FastIO, self).read()

    def readline(self):
        while self.newlines == 0:
            s = self._fill();
            self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.getvalue())
            self.truncate(0), self.seek(0)

class IOWrapper(IOBase):

    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            self.write = lambda s: self.buffer.write(s.encode('ascii'))
            self.read = lambda: self.buffer.read().decode('ascii')
            self.readline = lambda: self.buffer.readline().decode('ascii')

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip('\r\n')

# sys.stdin = open('input.txt', 'r')
# sys.stdout = open('output.txt', 'w')

""" main function"""

if __name__ == '__main__':
    main()
    # threading.Thread(target=main).start()

n=int(input())
s=sorted(map(int,input().split()))
ans=s[-1]
for i in range(n-1,-1,-1):
    if ans%s[i]or ans==s[i]:print(ans,s[i]);break

n = int(input())
arr = list(map(int,input().strip().split(" ")))

arr.sort(reverse = True)
print(arr)
i = arr[0]
for j in arr:
	if(arr.count(j)>1 or i%j):
		print(i,j)
		break

def main():
    n = int(input())
    divisors = list(map(int,input().split()))
    divisors.sort(reverse = True)
    first = divisors[0]
    second = divisors[1]
    for i in range(n):
        if first%divisors[i] != 0:
            second = divisors[i]
            break

    print (first,second)

main()

def div(a):
	max_val = max(a)
	res = factors(max_val)
	for i in a:
		if i not in res:
			print(max_val,i)
			return

def factors(n):
	x = []
	for i in range(1,n+1):
		if n%i == 0:
			x.append(i)
	return x

n = int(input())
a = list(map(int,input().split()))
div(a)

def solve():
    input()
    ar = []
    for i in (input().split(' ')):
        if i.isdigit():
            ar.append(int(i))
    print(ar)
    ar.sort()
    x = ar[-1]
    ary = []
    for i in ar:
        if x % i != 0:
            ary.append(i)
    y = ary[-1]
    print(x,' ',y)

solve()

n = int(input())
l = list(map(int,input().split()))
maxi = -1
imaxi = -1
for i in range(n):
    if(maxi < l[i]):
        maxi = l[i]
        imaxi = i

maxi2 = -1
for i in range(n):
    if(i != imaxi and (maxi%l[i] !=0 or l[i] == 1 or maxi == l[i])):
        maxi2 = max(maxi2,l[i])

n=int(input())
l=list(map(int,input().split()))
l.sort()
l.reverse()
if l[0]%l[1] != 0:
    print(l[0],' ',l[1])
else:
    for i in l:
        if l[0]%i != 0 and i!=l[0]:
            print(l[0],' ',i)
            break

cnt = lambda s, x: s.count(x)
ii = lambda: int(input())
si = lambda : input()
f = lambda : map(int,input().split())
il = lambda : list(map(int,input().split()))
n=ii()
l=sorted(il())[::-1]
i=0
while 1:
    if l[i]==l[i+1]:
        break
    i+=1
d=l[i]
j=1
while j<=i:
    if l[j]%d==0:
        break
    j+=1
print(l[0],l[j])

n=int(input())
s=set(map(int,input().split()))
L=[]
for e in s:
	L.append(e)
N=[0]*len(L)
for i in range(0,len(L)):
	for j in range(0,len(L)):
		if(L[i]%L[j]==0):
			N[i]+=1

for i in range(1,len(N)):
	for j in range(0,i):
		if(N[i]+N[j]==n):
			print(str(L[i])+" "+str(L[j]))
			break

a = int(input())
l = list(map(int,input().split()))
t = list(set(l))
print(t)
t1 = []
k = 1
for i in range(len(t)):
	k = k*t[i]
	l1 = l.count(t[i])
	t1.append(l1)
print(t1)
print(k,end=" ")
k = 1
for j in range(len(t)):
	k = k*(t[i]**(t1[i]-1))
print(k)

n=int(input())
g=[int(g) for g in input().split()]
g.sort()
l=[]
op=[]
for i in reversed(g):
    if g[-1]%i!=0:
        l.append(i)
        break
if l==[]:
    if g[-1]!=g[-2]:
        op.append(g[-1])
        op.append(g[-2])
    else:
        op.append(g[-1])
        op.append(g[-3])
else:
    op.append(g[-1])
    op.append(i)
print(op[0],op[1])

# For taking integer inputs.
import math

def inp():
    return(int(input()))

# For taking List inputs.
def inlist():
    return(list(map(int, input().split())))

# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
    s = input()
    return(list(s[:len(s)]))

# For taking space seperated integer variable inputs.
def invr():
    return(map(int, input().split()))

n = inp()

d = invr()

d = sorted(d, reverse=True)

a = d[0]
b = 1

for i in range(1, n):
    if a == d[i]:
        b = d[i]
        break
    elif a % d[i] != 0:
        b *= d[i]
print(a, b)

from math import gcd

n = int(input())
A = list(map(int, input().split()))
answer = 1
for i in range(n):
    answer *= (A[i] // gcd(A[i], answer))
print(1, answer)

# ///==========Libraries, Constants and Functions=============///
#mkraghav
import sys

inf = float("inf")
mod = 1000000007

def get_array(): return list(map(int, sys.stdin.readline().split()))

def get_ints(): return map(int, sys.stdin.readline().split())

def input(): return sys.stdin.readline()

def int1():return int(input())

import string

import math

from itertools import combinations
# ///==========MAIN=============///

def main():
    n=int1()
    a=get_array()
    x1=max(a)
    l=[]
    l1=[]
    i=1
    while i<=x1:
        if x1%i==0:
            l.append(i)
        i=i+1
    for i in a:
        if i not in l:
            l1.append(i)
    x2=max(l1)
    print(x1,x2)

if __name__ == "__main__":
    main()

n=int(input())
a=list(map(int,input().split()))
a=sorted(a)
x=a[-1]
y=a[-2]
a[-1]=0
for i in range(len(a)-1):
    if(x%a[i] == 0):
        a[i] = 0
if(a.count(0) == len(a)):
    print(x,y)
else:
    for i in range(len(a)):
        if(a[i]!=0):
            y=a[i]
            break
    print(x,y)

n=int(input())
g=[int(g) for g in input().split()]
g.sort()
for i in reversed(g):
    if g[-1]%i!=0:
        print(g[-1],i)
        break

k = int(input())

dic = {}

x = -1

for a in map(int, input().split()):
    if a > x:
        x = a
    if a in dic.keys():
        dic.update({a: dic.get(a)+1})
    else:
        dic.update({a: 1})

y = -1

for b in range(1, x+1):
    if b in dic.keys():
        if x % b == 0 and dic.get(b) ==2 and b > y:
            y = b
        if x % b != 0 and b > y:
            y = b

n = int(raw_input())
l=[int(x) for x in raw_input().split()]
l.sort(reverse = True)
print l[0]
if n==4:
    print l[0]
else:

    for i in range(len(l)-1):
        if l[0] % l[i+1] != 0:
            print l[i+1]
            break

        if i==n-2:
            if l[-1] == 1:
                print "1"
            else:
                print l[0]

def gcd(a,b):
    if(b==0):
        return a
    return gcd(b, a%b)
n = int(input())
l = list(map(int, input().split()))
l.sort()
a=l[-1]
b=0
for i in range(n-2,-1,-1):
    if(gcd(a, l[i])!=l[i]):
        b=l[i]
        break
print(a,b)

n=int(input())
l=list(map(int,input().split()))
m=max([i for i in l if l.count(i)==2])
l.sort(reverse=True)
if m==1:
    print(l[-1],l[-2])
else:
    for i in l:
        if i%m==0 and i!=m:
            print(i,end=' ')

from functools import reduce

if __name__ == '__main__':
    n = int(input())
    d = list(map(int, input().split()))
    d.sort(reverse=True)
    a = d[0]
    for j in range(1, n):
        good = True
        b = d[j]
        for k in range(j + 1, n):
            if a % d[k] == 0 or b % d[k] == 0:
                continue
            else:
                good = False
                break
        if good:
            print(a, d[j])
            exit(0)

def solve(x,y,l):
    for e in l:
        #print("x : ",x," y : ",y," e :", e)
        if( (x % e == 0 or y % e == 0) == False):
            #print("exit\n",x % e == 0 ,y % e == 0 , (x % e == 0 or y % e == 0))
            return False
    #print("good\n")
    return True

n = int(input())
l = list(map(int,input().split()))
l.sort(reverse = True)
#print(l)
for i in range(n):
    for j in range(i+1,n):
        if(solve(l[i],l[j],l)):
            print(l[i],l[j])
            break

n=int(input())
g=[int(g) for g in input().split()]
g.sort()
l=[]
for i in reversed(g):
    if g[-1]%i!=0:
        l.append(i)
        break
if l==[]:
    print(g[-1],g[-2])
else:
    print(g[-1],l[0])

n=int(input())
l=list(map(int,input().split()))
l=sorted(l,reverse=True)
x=l[0]
for i in range(1,len(l)):
    if(x%l[i]!=0):
        print(x,l[i])
        break

def factors(l):
    m= max(l)
    for i in range(1,int(m**(0.5))+1):
        if m%i == 0:
            if i in l:
                l.remove(i)
            if m//i in l:
                l.remove(m//i)
    return max(l)
n = int(input())
l = list(map(int,input().split()))
if len(l)==2:
    print(*l)
else:
    print(max(l),end = " ")
    print(factors(l))

n = int(input())
arr = list(map(int,input().strip().split(" ")))

arr.sort(reverse = True)
i = arr[0]
for j in arr:
	if(i%j):
		print(i,j)
		break

from collections import Counter
n = int(input())
arr = list(map(int,filter(None,input().split(' '))))
arr = sorted(arr)
def get_div(n):
    li = []
    for i in range(1,int(n/2)+1):
        if n%i==0:
            li.append(i)
    li.append(n)
    return li
n1 = arr[-1]
li2 = get_div(n1)
print(li2)
li3 = list((Counter(arr)-Counter(li2)).elements())
n2 = li3[-1]
print(n1,' ',n2)

# cf 1108 B (1100)
import math

n = int(input())
A = list(map(int, input().split()))

A.sort(reverse=True)

print(A)
x = A[0]
y = 1
for m in A[1:]:
    if m == 1:
        break
    if x % m == 0:
        y = m
        if x == y:
            break
    elif y == m:
        break
    else:
        y = m
        break
print(x, y)

import os
import sys
from io import BytesIO, IOBase
# region fastio

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# ------------------------------

from math import factorial
from collections import Counter, defaultdict
from heapq import heapify, heappop, heappush

def RL(): return map(int, sys.stdin.readline().rstrip().split())
def RLL(): return list(map(int, sys.stdin.readline().rstrip().split()))
def N(): return int(input())
def mdis(x1, y1, x2, y2): return abs(x1 - x2) + abs(y1 - y2)
mod = 998244353
INF = float('inf')
from math import gcd

# ------------------------------

def main():
    n = N()
    arr = RLL()
    arr.sort()
    a = arr[-1]
    b = -1
    for i in range(n-1, -1, -1):
        if a%arr[i]!=0:
            print(*[a, arr[i]])
            break
    print(*[arr[-1], arr[-2]])

if __name__ == "__main__":
    main()

# Divisors of Two Integers - codeforces
#

import math
import sys
input = sys.stdin.readline

def inp():
    return int(input())

def invr():
    return list(map(int, input().split()))

n = inp()
d = invr()
d.sort(reverse=1)
# d.reverse()

# print(d)

a = d.pop(0)
b = 0

work = 1

while len(d) > 0:
    e = d.pop(0)
    if a % e != 0:
        b = e
        break

print(a, b if b else a)

n = input()
list = map(int, raw_input().split())
list.sort()
list.reverse()
print list[0],
a=list[0]
for i in range(n):
    if a%list[i]==0:
        list[i]=0
list.sort()
list.reverse()
if list[0]!=0:
    print 0
else:
    print 1

from sys import stdin, stdout
n = int(input())
divs = list(map(int, input().split()))

mp = {}
for num in divs:
    if num not in mp.keys():
        mp[num] = 1
    else:
        mp[num] += 1

maxi = max(divs)

divs_maxi = []

for i in range(1,maxi//2):
	if (maxi % i) == 0 and (i not in divs_maxi):
		divs_maxi.append(i)
		divs_maxi.append(maxi//i)

set_divs =set(divs)
set_maxi_divs = set(divs_maxi)
c = list(set_divs.difference(set_maxi_divs))

if len(c) > 0:
	print(str(max(c)) + " " + str(maxi))
else:
	print(str(maxi) + " " + str(maxi))

# print(maxi)
# print(divs_maxi)

# for num in divs_maxi:
#     if num in mp.keys():
#         mp[num] -= 1
#     if mp[num] == 0:
#         mp.pop(num, 'None')

# if len(mp.keys()) > 0:
#     maxi_2 = max(mp.keys())
# else:
#     maxi_2 = maxi

# print(str(maxi) + " " + str(maxi_2))

def gcd(a, b):
    if a == 0 :
        return b

    return gcd(b%a, a)
n=int(raw_input())
a=list(map(int,raw_input().split()))
a = sorted(a)
for i in xrange(n-1,0,-1):
    if a[i] % a[i-1]!= 0:
        print a[i],a[i-1]
        break

n = int(input())
act  = list(map(int,input().split()))
p = sorted(dict.fromkeys(act))
a = max(p)
b=a
rej = []
mc = 0
m1= act.count(1)
for i in range(len(p)-1, -1,-1):
    mc = max(mc, act.count(p[i]))
for i in range(len(p)-1,-1,-1):
    if(a%p[i]!=0):
        b=p[i]
        break
if(m1>mc):
    b=1
print(a,b)

n=int(input())
li=list(map(int,input().split()))
#li.sort()
#print(li)
l=[]
for i in li:
	if li.count(i)==2:
		l.append(i)
l=list(set(l))
l.sort(reverse=True)
print(l)
if len(l)==1 and l[0]==1:
	print(1,max(li))
elif len(l)==1:
	li.sort(reverse=True)
	print(li[0],li[1])
elif len(li)==4:
	li.sort(reverse=True)
	print(li[0],li[1])
elif len(l)>3:
	l.sort(reverse=True)
	print(l[0],max(li))
else:
	for i in li:
		if i%l[0]==0 and i%l[1]==0 and i!=l[0] and i!=l[1]:
			print(i,end=" ")

n=int(input())
l=list(map(int,input().split()))
l.sort()
t=0
for i in range(n-1):
    if l[i]==l[i+1]:
        t=max(t,l[i])
a=l[-1]
b=0
for i in range(n):
    if l[i]%t==0 and l[i]!=a:
        b=max(b,l[i])
if b==0:
    b=a
print(a,b)

def pro(x):
    p,m=1,1
    if(len(x)==2):
    	m=0
    for i in range(m,len(x)):
        p*=x[i]
    return p
n=int(input())
l=[int(i) for i in input().split()]
l.sort(reverse=True)
z=l[:]
for j in l:
    for i in range(1,j+1):
        if(j%i==0):
            l.remove(i)
    #print(j,l)
    N=pro(l)
    if(N in l):
        print(j,N)
        break
    l=z[:]

def read_array():
    x = []
    x1 = []
    x = input()
    x = x.split(' ')
    for r in range(len(x)):
        x1.append(int(x[r]))
    return x1
def finding_two_div(x):
    x.sort(reverse=True)
    x1=x[0]
    for i in range(1,len(x)):
        #print(x1,x[i],x1%x[i])
        if x1%x[i]!=0 or x[i]==x1:
            return x1,x[i]
    if x[1]==x[2]:
        return x1,x[1]
    else:
        return x1,1
input()
a,b=finding_two_div(read_array())
print(a,b)

# import sys
# sys.stdin=open("input.in",'r')
# sys.stdout=open("out1.out",'w')
n=int(input())
a=list(map(int,input().split()))
s=set(a)
a=list(a)
a.sort()
x=a[-1]
for i in range(len(a)):
	if x%a[i]==0:
		a[i]=0

y=max(a)
print(x,y)

n = int(raw_input())
l = [int(i) for i in raw_input().split()]
l = sorted(l)
# print l
a = []
m = l[-1]
# print m
# print l
for i in l:
  if m % i != 0:
    a.append(i)

x = m
try:
  y = max(a)
except:
  y = x
print x , y

n=int(input())
l=list(map(int,input().split()))
l=sorted(l,reverse=True)
x=l[0]
for i in range(1,len(l)):
    if(x%l[i]!=0):
        print(x,l[i])
        break
else:
    print(x,l[1])

n=int(input())
arr=list(map(int,input().split()))

arr.sort()
print(arr[-1],end=' ')
for i in range(n-2,0,-1):
    if arr[-1]%arr[i]!=0:
        print(arr[i])
        break
    elif arr.count(arr[i])>1:
        print(arr[i])
        break

n=int(input())
ar=sorted(list(map(int,input().split())))
m=max(ar)
u=max([k%m for k in ar])
print(m,u)

n = int(input())

l = list(map(int,input().split()))

l.sort()

x = l[-1]
# print(l)
hash = set()
for i in l:
    if x%i == 0 and i not in hash:
        # print(i)
        hash.add(i)
        l.remove(i)

l.remove(x)

l.sort()
y = l[-1]

print(x,y)