x and y: Please! Find us.

0

0 votes
Easy
Problem

There are two unknown integers x and y. You are given a list containing all divisors of x (including 1 and x) and all divisors of y (including 1 and y). If d is a divisor of both numbers x and y at the same time, there are two occurrences of d in the list.

For example, if x=4 and y=6 then the given list can be any permutation of the list [1,2,4,1,2,3,6]. Some of the possible lists are: [1,1,2,4,6,3,2], [4,6,1,1,2,3,2] or [1,6,3,2,4,1,2].

Your task is to find x and y that would yield the same given list of divisor(possibly in different order).

It is guarantee that the answer exists.

Input:

The first line contains one integer n (2≤n≤128) — the number of divisors of x and y.

The second line of the input contains n integers d1 ,d2,…, dn  (1≤di ≤ 104), where di is either divisor of x or divisor of y .If a number is divisor of both numbers x and y then there are two copies of this number in the list.

Output:

Print two positive integer numbers x and y — such numbers that merged list of their divisors is the permutation of the given list of integers. Print largest number first and then smallest number.

Time Limit: 2
Memory Limit: 256
Source Limit:
Editor Image

?