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 C323C
{

private static StringTokenizer st;
    
    public static void nextLine(BufferedReader br) throws IOException
    {
        st = new StringTokenizer(br.readLine());
    }
    
    public static int nextInt()
    {
        return Integer.parseInt(st.nextToken());
    }
    
    public static String next()
    {
        return st.nextToken();
    }
    
    public static long nextLong()
    {
        return Long.parseLong(st.nextToken());
    }

    public static double nextDouble()
    {
        return Double.parseDouble(st.nextToken());
    }
    
    public static void main(String[] args) throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        nextLine(br);
        int n = nextInt();
        nextLine(br);
        
        HashMap<Long, Integer> map = new HashMap<Long, Integer>();
        for (int i = 0; i < n*n; i++)
        {
            long num = nextLong();
            if (!map.containsKey(num))
            {
                map.put(num, 1);
            }
            else
            {
                map.put(num, map.get(num) + 1);
            }
        }
        ArrayList<Pair> list = new ArrayList<Pair>();
        for (Map.Entry<Long, Integer> entry : map.entrySet())
        {
            list.add(new Pair(entry.getKey(), entry.getValue()));
        }
        Collections.sort(list);
        
        Map<Long, Integer> index = new HashMap<Long, Integer>();
        for (int i = 0; i < list.size(); i++)
        {
            index.put(list.get(i).num, i);
        }
        
        ArrayList<Long> ans = new ArrayList<Long>();
        for (int i = list.size() - 1; i >= 0; i--)
        {
            if (list.get(i).freq <= 0) continue;
            long num = list.get(i).num;
            //System.out.println("Processing " + num + " with rem freq " + list.get(i).freq);
            int divs = 0;
            HashMap<Long, Integer> remmap = new HashMap<Long, Integer>();
            for (int j = 0; j < ans.size(); j++)
            {
                long gcd = gcd(ans.get(j), num);
                if (num == gcd) divs++;
                else
                {
                    addCount(remmap, gcd, 2);
                }
            }
            int vol = solve(divs, list.get(i).freq);
            //System.out.println(vol);
            for (int j = 0; j < vol; j++)
            {
                ans.add(num);
            }
            for (Map.Entry<Long, Integer> e : remmap.entrySet())
            {
                //System.out.println("Minusing " + e.getValue() + " from " + e.getKey());
                list.get(index.get(e.getKey())).freq -= e.getValue() * vol;
            }
            if (ans.size() == n)
            {
                break;
            }
        }
        for (int i = 0; i < n; i++)
        {
            System.out.print(ans.get(i) + " ");
        }
    }
    
    public static int solve(int k, int v)
    {
        //System.out.println("Solving " + k + " " + v);
        int left = 0;
        int right = v/2 + 1;
        while (left < right)
        {
            int mid = (left + right) / 2;
            int calc = (2 * k + mid) * mid;
            if (calc == v) return mid;
            else if (calc < v) left = mid + 1;
            else right = mid - 1;
        }
        return left;
    }
    
    public static void addCount(HashMap<Long, Integer> map, long num, int count)
    {
        if (map.containsKey(num))
        {
            map.put(num, map.get(num) + count);
        }
        else
        {
            map.put(num, count);
        }
    }
    
    public static class Pair implements Comparable<Pair>
    {
        long num;
        int freq;
        
        public Pair(long n, int f)
        {
            num = n;
            freq = f;
        }
        
        @Override
        public int compareTo(Pair p)
        {
            return new Long(num).compareTo(p.num);
        }
        
        @Override
        public String toString()
        {
            return "(" + num + "," + freq + ")";
        }
        
    }

    static long gcd(long a, long b)
    {
        if (a < b) return gcd(b, a);
        if (b == 0) return a;
        else return gcd(b, a % b);
    }
}