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 
    	
    		
    		    /*
    		     * Author- Priyam Vora
    		     * BTech 2nd Year DAIICT
    		     */
    		     
    		            
    		    import java.io.*;
    		    import java.math.*;
    		    import java.util.*;
    		    import javax.print.attribute.SetOfIntegerSyntax;


    		     
    		    public class Main{
    		    	private static InputStream stream;
    		    	private static byte[] buf = new byte[1024];
    		    	private static int curChar;
    		    	private static int numChars;
    		    	private static SpaceCharFilter filter;
    		    	private static PrintWriter pw;
    		     
    		        public static void main(String[] args) {
    		        	InputReader(System.in);
    		    		pw = new PrintWriter(System.out); 
    		            new Thread(null ,new Runnable(){
    		               public void run(){
    		                   try{
    		                       soln();
    		                       pw.close();
    		                   } catch(Exception e){
    		                       e.printStackTrace();
    		                   }
    		               }
    		           },"1",1<<26).start();
    		       }
    		     	public static long gcd(long x, long y) {
    		    		if (x == 0)
    		    			return y;
    		    		else
    		    			return gcd( y % x,x);
    		    	}
    		    	// To Get Input
    		    	// Some Buffer Methods
    		     
    		    	public static void InputReader(InputStream stream1) {
    		    		stream = stream1;
    		    	}
    		     
    		    	private static boolean isWhitespace(int c) {
    		    		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    		    	}
    		     
    		    	private static boolean isEndOfLine(int c) {
    		    		return c == '\n' || c == '\r' || c == -1;
    		    	}
    		     
    		    	private static 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++];
    		    	}
    		     
    		    	private static 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;
    		    	}
    		     
    		    	private static 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;
    		    	}
    		     
    		    	private static 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();
    		    	}
    		     
    		    	private static 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();
    		    	}
    		     
    		    	private static int[] nextIntArray(int n) {
    		    		int[] arr = new int[n];
    		    		for (int i = 0; i < n; i++) {
    		    			arr[i] = nextInt();
    		    		}
    		    		return arr;
    		    	}
    		     
    		    	private static int[][] next2dArray(int n, int m) {
    		    		int[][] arr = new int[n][m];
    		    		for (int i = 0; i < n; i++) {
    		    			for (int j = 0; j < m; j++) {
    		    				arr[i][j] = nextInt();
    		    			}
    		    		}
    		    		return arr;
    		    	}
    		    	private static char[][] nextCharArray(int n,int m){
    		    		char [][]c=new char[n][m];
    		    		for(int i=0;i<n;i++){
    		    			String s=nextLine();
    		    			for(int j=0;j<s.length();j++){
    		    				c[i][j]=s.charAt(j);
    		    			}
    		    		}
    		    		return c;
    		    	}
    		     
    		    	private static long[] nextLongArray(int n) {
    		    		long[] arr = new long[n];
    		    		for (int i = 0; i < n; i++) {
    		    			arr[i] = nextLong();
    		    		}
    		    		return arr;
    		    	}
    		     
    		    	private static void pArray(int[] arr) {
    		    		for (int i = 0; i < arr.length; i++) {
    		    			pw.print(arr[i] + " ");
    		    		}
    		    		pw.println();
    		    		return;
    		    	}
    		     
    		    	private static void pArray(long[] arr) {
    		    		for (int i = 0; i < arr.length; i++) {
    		    			pw.print(arr[i] + " ");
    		    		}
    		    		pw.println();
    		    		return;
    		    	}
    		     
    		    	private static void pArray(boolean[] arr) {
    		    		for (int i = 0; i < arr.length; i++) {
    		    			pw.print(arr[i] + " ");
    		    		}
    		    		pw.println();
    		    		return;
    		    	}
    		     
    		    	private static boolean isSpaceChar(int c) {
    		    		if (filter != null)
    		    			return filter.isSpaceChar(c);
    		    		return isWhitespace(c);
    		    	}
    		     
    		    	private interface SpaceCharFilter {
    		    		public boolean isSpaceChar(int ch);
    		    	}
    		
 //----------------------------------------My Code------------------------------------------------//
    		   static LinkedList<Integer> adj[];
    		   static boolean Visited[];
    		   static int deg[];
    		   static int V;
    		   static int subtree_size[];
    		   static int i=0;
    		   private static void soln() {
    			   
    		
    			   int n=nextInt();
    			   TreeSet<Integer> ts=new TreeSet<Integer>();
    			   HashMap<Integer,Integer> hm=new HashMap<Integer,Integer>();
    			   for(int i=0;i<n*n;i++){
    				   int d=nextInt();
    				   ts.add(d);
    				   if(hm.containsKey(d)){
    					   hm.replace(d, hm.get(d)+1);
    				   }else{
    					   hm.put(d, 1);
    				   }
    			   }
    			   int last=ts.last();
    			   ArrayList<Integer> a=new ArrayList<Integer>();
    			   a.add(last);
    			   hm.replace(last, hm.get(last)-1);
    			   if(hm.get(last)==0)
    			   ts.remove(ts.last());
    			   while(!ts.isEmpty()){
    				   last=ts.last();
    				   
    				   for(int x: a){
    					   int gcd=(int)gcd(x,last);
    					   hm.replace(gcd, hm.get(gcd)-2);
    					   if(hm.get(gcd)==0){
    						   ts.remove(gcd);
    					   }
    				   }
    				   a.add(last);
    				   hm.replace(last, hm.get(last)-1);
    				   if(hm.get(last)==0){
    					   ts.remove(ts.last());
    				   }
    			   }
    			   for(int i=0;i<a.size();i++)
    			   pw.print(a.get(i)+" ");
    		   }
    		   public static int dfs(String s)
    		   {
    			   if(s.charAt(i++)=='l')
    				   return 1;
    			   else
    				   return Math.max(dfs(s),dfs(s))+1;
    		   }
    		   
//-----------------------------------------The End--------------------------------------------------------------------------//

    		   private static void size(int curr,int par){
    			   Visited[curr]=true;
    			   for(int x:adj[curr]){
    				   if(!Visited[x]){
    					   size(x,curr);
    				   }
    			   }
    			   subtree_size[par]+=subtree_size[curr];
    		   }
	
    		   private static boolean isEulerian(){
    			   int odd=0;
    			   for(int i=1;i<=V;i++){
    				   if(adj[i].size()%2!=0){
    					   odd++;
    				   }
    			   }
    			   if(odd==0 || odd==2){
    				   return true;
    			   }
    			   return false;
    		   }
    		   private static boolean isConnected(){
    			   int flag=1;
    			   for(int i=1;i<=V;i++){
    				   if(adj[i].size()>0){
    					   dfs(i);
    					   flag=0;
    					   break;
    				   }
    			   }
    			   if(flag==1){
    				   return true;
    			   }
    			   for(int i=1;i<=V;i++){
    				   if(adj[i].size()>0 && Visited[i]==false)
    					   return false;
    			   }
    			return true;
    		   }
    		   
    		   private static void dfs(int curr){
    			   Visited[curr]=true;
    			   for(int x:adj[curr]){
    				   if(!Visited[x])
    					   dfs(x);
    			   }
    		   }
    		   
    		   private static void buildGraph(){
		    		
    			   adj=new LinkedList[V+1];
		    		Visited=new boolean[V+1];
		    		deg=new int[V+1];
		    		subtree_size=new int[V+1];
		    		Arrays.fill(subtree_size, 1);
		    		for(int i=0;i<=V;i++){
		    			adj[i]=new LinkedList<Integer>();
		    		}
		    		
		    	}
    		    }
