GCD Table

Given all N^2 pairwise gcd values of a hidden sequence in random order, recover the sequence.

Medium7MathNumber theoryGreedyHash mapNo attempts yetTime limit2sMemory limit512 MB

Problem

For a sequence A=(a1,a2,,aN)A = (a_1, a_2, \dots, a_N) of length NN, the GCD table GG is defined by

gij=gcd(ai,aj)g_{ij} = \gcd(a_i, a_j)

where gcd(x,y)\gcd(x, y) is the greatest common divisor of xx and yy. For example, the GCD table of A=(4,3,6,2)A = (4, 3, 6, 2) is

4362
44122
31331
62362
22122

All N2N^2 values of the GCD table GG are given in arbitrary order. Restore the original sequence AA.

Input

The first line contains the length NN of the sequence AA (1N5001 \le N \le 500).

The second line contains the N2N^2 values of the GCD table in arbitrary order, separated by spaces. Every value is a positive integer no larger than 1,000,000,0001{,}000{,}000{,}000. The input always admits an answer.

Output

Print the NN elements of the restored sequence on one line, separated by single spaces.

Any ordering of the elements gives the same GCD table, so print them in non-decreasing order. That is the lexicographically smallest answer. The multiset of elements is uniquely determined.