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.util.*;
import java.io.*;
//558A
public class Test{
	public static void main(String[] args) throws Exception{
		
		InputReader sc = new InputReader(System.in);
		PrintWriter wr = new PrintWriter(System.out);
		int n=sc.nextInt();
		int[] arr=new int[n*n];
		Map<Integer,Integer> con=new HashMap<Integer,Integer>();
 		for(int i=0;i<n*n;i++){
			arr[i]=sc.nextInt();
			if(con.containsKey(arr[i])){
				con.put(arr[i],con.get(arr[i])+1);
			}
			else con.put(arr[i],1);
		}
		Arrays.sort(arr);
		int k=0;
		int[] ans=new int[n];
		Map<Integer,Integer> mp=new HashMap<Integer,Integer>();
		for(int i=n*n-1;k<n;i--){
			if(con.containsKey(arr[i])&&con.get(arr[i])>0){
				ans[k]=arr[i];
				con.put(arr[i],con.get(arr[i])-1);
				k++;
				System.out.print(ans[k-1]+" ");
				for(int x=0;x<k-1;x++){
					con.put(GCD(ans[x],arr[i]),con.get(GCD(ans[x],arr[i]))-2);
				}
		//		System.out.println(con);
			}
		}
	}
	public static long solve(int[] p,long[][] arr,long[] s,int strt,int m,int k){
		if(k==0) return 0;
		else{
			int n=p.length;
			long max=0;
			for(int i=strt;i<=n-m;i++){
				long y=0;
				if(arr[k][i]==0){
					y+=s[i];
					y+=solve(p,arr,s,i+m,m,k-1);
					if(y>max) max=y;
					arr[k][i]=y;
				}
				else{
					if(arr[k][i]>max) max=arr[k][i];
				}
			}
		//	System.out.println(max);
			return max;
		}
	}
	
	
	public static int GCD(int value1, int value2)
    {
        while (value1 != 0 && value2 != 0)
        {
            if (value1 > value2)
                value1 %= value2;
            else
                value2 %= value1;
        }
        return Math.max(value1, value2);
    }	
	public static long power(long a,long b)
	{
	    long ans=1;
	    while(b>0)
	    {
	        if(b%2==1)
	        {
	            ans*=a;
	            ans=ans%1000000007;
	        }
	        a*=a;
	        a=a%1000000007;
	        b/=2;
	    }
	    return ans%1000000007;
	}
}
class InputReader{
	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;
 
	public InputReader(InputStream stream) {
		this.stream = stream;
	}
 
	public static boolean isWhitespace(int c) {
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}
	
	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		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 int nextInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			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 res * sgn;
	}
 
	public long nextLong() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int 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 (!isSpaceChar(c));
		return res * sgn;
	}
 
	public String nextToken() {
		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 String nextLine() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isEndOfLine(c));
		return res.toString();
	}

	public int[] nextIntArray(int n) {
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = nextInt();
		}
		return arr;
	}
	  
	public long[] nextLongArray(int n) {
		long[] arr = new long[n];
		for (int i = 0; i < n; i++) {
			arr[i] = nextLong();
		}
		return arr;
	}

	public void pArray(int[] arr){
		for (int i=0; i<arr.length; i++) {
			System.out.print(arr[i] + " ");
		}
		System.out.println();
		return;
	}

	public void pArray(long[] arr){
		for (int i=0; i<arr.length; i++) {
			System.out.print(arr[i] + " ");
		}
		System.out.println();
		return;		
	}

	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return isWhitespace(c);
	}
 
	private boolean isEndOfLine(int c) {
		return c == '\n' || c == '\r' || c == -1;
	}
	
	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}

}