The GCD table G of size n × n for an array of positive integers a of length n is defined by formula 

<image>

Let us remind you that the greatest common divisor (GCD) of two positive integers x and y is the greatest integer that is divisor of both x and y, it is denoted as <image>. For example, for array a = {4, 3, 6, 2} of length 4 the GCD table will look as follows:

<image>

Given all the numbers of the GCD table G, restore array a.

Input

The first line contains number n (1 ≤ n ≤ 500) — the length of array a. The second line contains n2 space-separated numbers — the elements of the GCD table of G for array a. 

All the numbers in the table are positive integers, not exceeding 109. Note that the elements are given in an arbitrary order. It is guaranteed that the set of the input data corresponds to some array a.

Output

In the single line print n positive integers — the elements of array a. If there are multiple possible solutions, you are allowed to print any of them.

Examples

Input

4
2 1 2 3 4 3 2 6 1 1 2 2 1 2 3 2


Output

4 3 6 2

Input

1
42


Output

42 

Input

2
1 1 1 1


Output

1 1 
import java.io.*;
import java.util.*;

public class C {

    public static void main(String[] args) throws Exception {
        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

        int N = in.nextInt();
        int N2 = N*N;

        PriorityQueue<Integer> maxHeap = new PriorityQueue<>(N2, Comparator.<Integer>reverseOrder());
        HashMap<Integer, Integer> int_unused = new HashMap<>(N2);
        int x;
        for (int i = 0; i < N2; i++) {
            x = in.nextInt();
            maxHeap.add(x);
            int_unused.put(x, int_unused.getOrDefault(x, 0) + 1);
        }

        int found = 0;
        int times;
        int g;
        int[] foundNums = new int[N];
        while(found < N) {
            x = maxHeap.poll();
            times = int_unused.get(x);
            if (times > 0) {
                found++;
                int_unused.put(x, times - 1);

                out.print(x);
                if (found < N) {
                    out.write(' ');
                    for (int i = 0; i < found - 1; i++) {
                        g = gcd(x, foundNums[i]);
                        int_unused.put(g, int_unused.get(g) - 2);
                    }
                    foundNums[found-1] = x;
                } else {
                    break;
                }
            }
        }

        out.write('\n');
        out.close();
    }

    static int gcd(int n, int m) {
        if (m == 0)
            return n;

        return gcd(m, n % m);
    }
}

class InputReader {

    private InputStream stream;
    private byte[] buf = new byte[2048];
    private int curChar;
    private int numChars;
    private SpaceCharFilter filter;

    public InputReader() {
        this.stream = System.in;
    }

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public InputReader(SpaceCharFilter filter) {
        this.stream = System.in;
        this.filter = filter;
    }

    public InputReader(InputStream stream, SpaceCharFilter filter) {
        this.stream = stream;
        this.filter = filter;
    }

    public int read() {
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }

    public char nextChar() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        return (char) c;
    }

    public int nextDigit() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        return c - '0';
    }

    public int nextInt() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        boolean negative = false;
        if (c == '-') {
            negative = true;
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return negative ? -res : res;
    }

    public int nextUnsignedInt() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int res = 0;
        do {
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res;
    }

    public final long nextLong() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        boolean negative = false;
        if (c == '-') {
            negative = true;
            c = read();
        }
        long res = 0;
        do {
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return negative ? -res : res;
    }

    public final long nextUnsignedLong() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        long res = 0;
        do {
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res;
    }

    public double nextDouble() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        long sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!(c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1 || c == '.'));

        if (c != '.') {
            return res * sgn;
        }
        c = read();

        long aft = 0;
        int len = 1;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            aft *= 10;
            len *= 10;
            aft += c - '0';
            c = read();
        } while (!isSpaceChar(c));

        return res * sgn + aft / (1.0 * len);
    }

    public String nextLine() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isEndChar(c));
        return res.toString();
    }

    public boolean isSpaceChar(int c) {
        if (filter != null)
            return filter.isSpaceChar(c);
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public boolean isEndChar(int c) {
        if (filter != null)
            return filter.isSpaceChar(c);
        return c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public String next() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }

    public char[] nextChars() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));

        char[] chars = new char[res.length()];
        res.getChars(0, chars.length, chars, 0);
        return chars;
    }

    public interface SpaceCharFilter {
        public boolean isSpaceChar(int ch);
    }
}