#P1108B. Divisors of Two Integers
Divisors of Two Integers
Description
Recently you have received two positive integer numbers and . You forgot them, but you remembered a shuffled list containing all divisors of (including and ) and all divisors of (including and ). If is a divisor of both numbers and at the same time, there are two occurrences of in the list.
For example, if and then the given list can be any permutation of the list . Some of the possible lists are: , or .
Your problem is to restore suitable positive integer numbers and that would yield the same list of divisors (possibly in different order).
It is guaranteed that the answer exists, i.e. the given list of divisors corresponds to some positive integers and .
The first line contains one integer () — the number of divisors of and .
The second line of the input contains integers (), where is either divisor of or divisor of . If a number is divisor of both numbers and then there are two copies of this number in the list.
Print two positive integer numbers and — such numbers that merged list of their divisors is the permutation of the given list of integers. It is guaranteed that the answer exists.
Input
The first line contains one integer () — the number of divisors of and .
The second line of the input contains integers (), where is either divisor of or divisor of . If a number is divisor of both numbers and then there are two copies of this number in the list.
Output
Print two positive integer numbers and — such numbers that merged list of their divisors is the permutation of the given list of integers. It is guaranteed that the answer exists.