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.*;
import java.math.BigInteger;
import java.math.MathContext;
import java.text.DecimalFormat;
import java.text.Format;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
 
public class Main {
	public static void main(String[] args) throws IOException{
		InputReader in = new InputReader(System.in);
		Printer out = new Printer(System.out);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}

 
static class TaskA {
	//public ArrayList<Integer> ar;
	public boolean[] bs;
	
  // GCD && LCM 
	 long gcd(long a ,long b){return b == 0 ? a : gcd(b , a % b);}
	 long lcm(long a , long b){return a*(b/gcd(a, b));}
	
  // Sieve of erothenese
	void sieve(int UB){
	//	ar = new ArrayList();
		bs = new boolean[UB+1];
		bs[0] = bs[1] = true;
		for(int i = 2; i*i <= UB; i++){
			if(!bs[i]){
				for(int j = i*i ; j <= UB ; j += i)
					bs[j] = true;
			}
		}
		/* for(int i = 2; i <= UB; i++){
		      if(!bs[i])ar.add(i);
		}*/
	}
	
	
	
	
	
	
	
	
	/*          SOLUTION  IS RIGHT HERE     */
	public void solve(int testNumber, InputReader in, Printer out) throws IOException{
		 // BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		 // Scanner sc = new Scanner(System.in);
		
		
		
		 int n = in.nextInt();
		 
		 ArrayList<Integer> list = new ArrayList<>();
		 
		 for(int i = 0; i < n*n; i++)
			 list.add(in.nextInt());
		 
		 sort(list , reverseOrder());
		 HashMap<Integer, Integer> map = new HashMap<>();
		 int[] res = new int[n];
		 int l = 0;
		 //out.println((double)Integer.MAX_VALUE);
		 for(int i = 0; i <  n*n ; i++){
			 if(map.containsKey(list.get(i))){
				 int freq = map.get(list.get(i));
			     if(freq == 1)
			    	 map.remove(list.get(i));
			     else
			    	 map.put(list.get(i), freq - 1);
				 
			 }else{
				 res[l] = list.get(i);
				 for(int j = 0; j < l; j++){
					int gcd = (int) gcd(list.get(i) , res[j]);
					if(map.containsKey(gcd))
						map.put(gcd, map.get(gcd)+2);
					else
						map.put(gcd, 2);
				 }
				 l++;
				 
			 }
		 }
		 for(int I : res)
			 out.print(I+" ");
 	 }
}
  
  
 // ||||||| INPUT READER ||||||||
 static class InputReader {
	private byte[] buf = new byte[2048];
	private int index;
	private int total;
	private InputStream in;
	
	public InputReader(InputStream stream){
		in = stream;
	}
	
	public int scan() throws IOException{
		if(total < 0)
			throw new InputMismatchException();
		if(index >= total){
			index = 0; 
			total = in.read(buf);
			if(total <= 0)
				return -1;
		}
		return buf[index++];
	}
	public long scanlong() throws IOException{
		long integer = 0;
		int n = scan();
		while(isWhiteSpace(n))
			n = scan();
		int neg = 1;
		if(n == '-'){
			neg = -1;
			n = scan();
		}
		while(!isWhiteSpace(n)){
			if(n >= '0' && n <= '9'){
				integer *= 10;
				integer += n - '0';
				n = scan();
			}
			else throw new InputMismatchException();
		}
		return neg*integer;
	}
	
	private int scanInt() throws IOException {
		int integer = 0;
		int n = scan();
		while(isWhiteSpace(n))
			n = scan();
		int neg = 1;
		if(n == '-'){
			neg = -1;
			n = scan();
		}
		while(!isWhiteSpace(n)){
			if(n >= '0' && n <= '9'){
				integer *= 10;
				integer += n - '0';
				n = scan();
			}
			else throw new InputMismatchException();
		}
		return neg*integer;
	}
	
	public double scandouble() throws IOException{
		double doubll = 0;
		int n = scan();
		int neg = 1;
		while(isWhiteSpace(n))
			n = scan();
		if(n == '-'){
			neg = -1;
			n = scan();
		}
		while(!isWhiteSpace(n) && n != '.'){
			if(n >= '0' && n <= '9'){
				doubll *= 10;
				doubll += n - '0';
				n = scan();
			}
		}
		if(n == '.'){
			n = scan();
			double temp = 1;
			while(!isWhiteSpace(n)){
				if(n >= '0' && n <= '9'){
					temp /= 10;
					doubll += (n - '0')*temp;
					n = scan();
				}
			}
		}
		return neg*doubll;
	}
	
	private float scanfloat() throws IOException {
		float doubll = 0;
		int n = scan();
		int neg = 1;
		while(isWhiteSpace(n))
			n = scan();
		if(n == '-'){
			neg = -1;
			n = scan();
		}
		while(!isWhiteSpace(n) && n != '.'){
			if(n >= '0' && n <= '9'){
				doubll *= 10;
				doubll += n - '0';
				n = scan();
			}
		}
		if(n == '.'){
			n = scan();
			double temp = 1;
			while(!isWhiteSpace(n)){
				if(n >= '0' && n <= '9'){
					temp /= 10;
					doubll += (n - '0')*temp;
					n = scan();
				}
			}
		}
		return neg*doubll;
	}
	public String scanstring() throws IOException{
		StringBuilder sb = new StringBuilder();
		int n = scan();
		while(isWhiteSpace(n))
			n = scan();
		while(!isWhiteSpace(n)){
			sb.append((char)n);
			n = scan();
		}
		return sb.toString();
	}
	
	
	public boolean isWhiteSpace(int n){
		if(n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1)
			return true;
		return false;
	}
/// Input module 	
	
	public int nextInt() throws IOException{
	  return scanInt();
	}
	
	public long nextLong() throws IOException{
		  return  scanlong();
		}
	
	public double nextDouble() throws IOException{
		  return  scandouble();
		}
	
	public float nextFloat() throws IOException{
		  return scanfloat();
		}

	public String next() throws IOException{
		return scanstring();
	}
}


// output writer
static class Printer{
	private final BufferedWriter bw;
	public Printer(OutputStream out){
		bw = new BufferedWriter(new OutputStreamWriter(out));
	}
	
    public void print(Object...objects) throws IOException{
    	for(int i = 0; i < objects.length; i++){
    		if(i != 0)
    			bw.append(' ');
    		bw.append(objects[i].toString());
    	}
    }
	public void print(String str) throws IOException{
		bw.append(str);
	}
	
	public void println(Object...objects) throws IOException {
		print(objects);
		bw.append("\n");
	}
	
	public void close() throws IOException{
		bw.close();
	}
	
	public void flush() throws IOException{
		bw.flush();
	}
}

static class IOUtils {
    public static int[] readIntArray(InputReader in, int size) throws IOException {
        int[] array = new int[size];
        for (int i = 0; i < size; i++) {
            array[i] = in.nextInt();
        }
        return array;
    }
  }
}

