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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashMap;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.util.Comparator;
import java.util.Collections;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Artem Gilmudinov
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Reader in = new Reader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, Reader in, PrintWriter out) {
            int n = in.ni();
            ArrayList<Integer> nums = new ArrayList<>();
            for (int i = 0; i < n * n; i++) {
                nums.add(in.ni());
            }
            Collections.sort(nums, new Comparator<Integer>() {

                public int compare(Integer o1, Integer o2) {
                    return o2 - o1;
                }
            });
            ArrayList<Integer> picked = new ArrayList<>();
            int m = n * n;
            HashMap<Integer, Integer> c = new HashMap<>();
            for (int v : nums) {
                if (c.containsKey(v)) {
                    c.put(v, c.get(v) + 1);
                } else {
                    c.put(v, 1);
                }
            }
            for (int i = 0; i < m; ) {
                int j = i;
                int num = nums.get(i);
                int cnt = c.get(num);
                for (; j < m; j++) {
                    if (nums.get(j) != num) {
                        break;
                    }
                }
                if (cnt == 0) {
                    i = j;
                    continue;
                }
                int div = 0;
                for (Integer v : picked) {
                    if (v % num == 0) {
                        ++div;
                    }
                }
                int z = 1;
                for (; ; z++) {
                    if (2 * div * z + z * z == cnt) {
                        break;
                    }
                }
                for (Integer v : picked) {
                    if (v % num != 0) {
                        int gcd = Utils.gcd(v, num);
                        c.put(gcd, c.get(gcd) - 2 * z);
                    }
                }
                while (z != 0) {
                    picked.add(num);
                    --z;
                }
                i = j;
            }
            for (Integer v : picked) {
                out.print(v + " ");
            }
        }

    }

    static class Utils {
        public static int gcd(int a, int b) {
            if (b == 0) {
                return a;
            }
            return gcd(b, a % b);
        }

    }

    static class Reader {
        private BufferedReader in;
        private StringTokenizer st = new StringTokenizer("");
        private String delim = " ";

        public Reader(InputStream in) {
            this.in = new BufferedReader(new InputStreamReader(in));
        }

        public String next() {
            if (!st.hasMoreTokens()) {
                st = new StringTokenizer(rl());
            }
            return st.nextToken(delim);
        }

        public String rl() {
            try {
                return in.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        public int ni() {
            return Integer.parseInt(next());
        }

    }
}

