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
{


    PrintWriter out;
    int i = 0, j = 0;


    void solve()
    {
        /**************START**************/
        FastScanner in = new FastScanner(System.in);
        HashSet<Integer> unpaired = new HashSet<Integer>();
        TreeMap<Integer, Integer> pairs = new TreeMap<Integer,Integer>();
        ArrayList<Integer> solution = new ArrayList<Integer>();
        //TreeMap<Integer, Integer> allNums = new TreeMap<>();



        int[] counters;
        int n = in.nextInt();
        if (n == 1)
            counters = new int[2];
        else
            counters = new int[n*(n+1)/2 + 1];
        TreeSet<Integer> allNums = new TreeSet<>();
        HashMap<Integer, Integer> numToInd = new HashMap<>();
        int curInd = 0;
        int cur;
        int curVal;
        StringBuilder sb = new StringBuilder();
        for (i = 0; i < n*n; i++)
        {
            cur = in.nextInt();
            if (numToInd.containsKey(cur))
            {
                counters[numToInd.get(cur)]++;
            }
            else
            {
                numToInd.put(cur, curInd);
                counters[curInd]++;
                curInd++;
            }
            allNums.add(cur);
            /*
            if (allNums.containsKey(cur))
                allNums.put(cur, allNums.get(cur)+1);
            else
                allNums.put(cur, 1);
            if (!unpaired.contains(cur))
            {
                unpaired.add(cur);
            }
            else
            {
                unpaired.remove(cur);
                int amt = (!pairs.containsKey(cur)) ? 1 : pairs.get(cur)+1;
                pairs.put(cur, amt);
            }
            */
        }
        sb.append(allNums.last()).append(' ');
        solution.add(allNums.last());
        counters[numToInd.get(allNums.last())]--;
        if (counters[numToInd.get(allNums.last())] == 0)
        {
            allNums.remove(allNums.last());
        }
        while (solution.size() < n)
        {
            int highVal = allNums.last();
            counters[numToInd.get(allNums.last())]--;
            if (counters[numToInd.get(allNums.last())] == 0)
            {
                allNums.remove(allNums.last());
            }
            for (Integer x : solution)
            {
                int theGCD = (int)gcd(highVal, x.longValue());
                counters[numToInd.get(theGCD)]-=2;
                if (counters[numToInd.get(theGCD)] == 0)
                {
                    allNums.remove(theGCD);
                }
            }
            solution.add(highVal);
            sb.append(highVal).append(' ');

        }

        out.println(sb.toString());
        /*
        solution.addAll(unpaired);
        Collections.sort(solution);

        int candidate;
        while (solution.size() != n)
        {

            candidate = pairs.lastKey();

            int pCount = 1;


            pairs.put(candidate, pairs.get(candidate)-2);


            int curGCD = 0;
            for (Integer y : solution)
            {
                curGCD = (int)gcd(y.longValue(), (long)candidate);
                System.out.println("GCD of " + y + " and " + candidate + ": " + curGCD);
                pairs.put(curGCD, pairs.get(curGCD)-pCount);
                if (pairs.get(curGCD) == 0)
                {
                    pairs.remove(curGCD);
                }
                else if (pairs.get(curGCD) < 0)
                {
                    throw new NumberFormatException();
                }
            }
            solution.add(candidate);
            solution.add(candidate);


            Collections.sort(solution);


        }

        for (Integer x : solution)
        {
            out.print(x + " ");
        }
        out.println();
        */



        /***************END***************/
    }
    private static long gcd(long a, long b)
    {
        if (a == 1 || b == 1)
        {
            return 1;
        }
        while (b > 0)
        {
            long temp = b;
            b = a % b; // % is remainder
            a = temp;
        }
        return a;
    }

    public static void main(String[] args)
    {
        new C().runIO();
    }

    void runIO()
    {

        out = new PrintWriter(System.out);

        solve();

        out.close();
    }

    void printGrid(char[][] g)
    {
        for (int a = 0; a < g.length; a++)
        {
            out.println(new String(g[a]));
        }
    }

    class FastScanner
    {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(File f)
        {
            try
            {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e)
            {
                e.printStackTrace();
            }
        }

        public FastScanner(InputStream f)
        {
            br = new BufferedReader(new InputStreamReader(f));
        }

        String next()
        {
            while (st == null || !st.hasMoreTokens())
            {
                String s = null;
                try
                {
                    s = br.readLine();
                } catch (IOException e)
                {
                    e.printStackTrace();
                }
                if (s == null)
                    return null;
                st = new StringTokenizer(s);
            }
            return st.nextToken();
        }

        //This will empty out the current line (if non-empty) and return the next line down. If the next line is empty, will return the empty string.
        String nextLine()
        {
            st = null;
            String s = null;
            try
            {
                s = br.readLine();
            } catch (IOException e)
            {
                e.printStackTrace();
            }
            return s;
        }

        boolean hasMoreTokens()
        {
            while (st == null || !st.hasMoreTokens())
            {
                String s = null;
                try
                {
                    s = br.readLine();
                } catch (IOException e)
                {
                    e.printStackTrace();
                }
                if (s == null)
                    return false;
                st = new StringTokenizer(s);
            }
            return true;
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }


        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }
    }
}
