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.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;


public class Round323Div2Problem3 {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		int sqn = n * n;
		List<Integer> list = new ArrayList<Integer>(sqn);
		
		Map<Integer, Integer> countMap = new TreeMap<Integer, Integer>(new Comparator<Integer>(){

			@Override
			public int compare(Integer o1, Integer o2) {
				
				return o2-o1;
			}
			
		});
			
		
		
		for(int i = 0; i < sqn; ++i){
			int value = sc.nextInt();
			Integer count = countMap.get(value);
			if(null == count){
				countMap.put(value, 1);
			}
			else{
				countMap.put(value,  count+1);
			}
		}
		
		List<Integer> numbers = new ArrayList<Integer>();
		
		List<Integer> dnumberList = new ArrayList<Integer>();
		for(Integer key: countMap.keySet()){
			dnumberList.add(key);
		}
		
		for(int i = 0; i < dnumberList.size(); ++i){
			Integer number = dnumberList.get(i);
			Integer count = countMap.get(number);
			if(count == 0){
				continue;
			}
			
			countMap.put(number, count-1);
			numbers.add(number);
			
			if(numbers.size() == n){
				break;
			}
			else{
				
				for(int j = 0; j < numbers.size()-1; ++j){
					int gcd = getGcd(numbers.get(j), number);
					countMap.put(gcd, countMap.get(gcd) -2);
				}
			}
			
			if(countMap.get(number) > 0){
				i--;
			}
		}
		
		for(int i = 0; i < numbers.size(); ++i){
			System.out.print(numbers.get(i));
			if(i < numbers.size()-1){
				System.out.print(" ");
			}
		}
		System.out.println();
		sc.close();		
		return;
	
		
		
	}
	
	private static int getGcd(int big, int small){
		 int rem = big % small;
		 if(rem == 0){
			 return small;
		 }
		 else if(rem == 1){
			 return 1;
		 }
		 else{
			 return getGcd(small, rem);
		 }
	}

	
	/* TLE
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		int sqn = n * n;
		List<Integer> list = new ArrayList<Integer>(sqn);
		
		for(int i = 0; i < sqn; ++i){
			list.add(sc.nextInt());
		}

		Collections.sort(list, new Comparator<Integer>(){

			@Override
			public int compare(Integer o1, Integer o2) {
				
				return o2-o1;
			}
			
		});
		boolean[] flag = new boolean[sqn];
		
		List<Integer> numbers = new ArrayList<Integer>();
		while(numbers.size() < n){
			int max = getMax(list, numbers.size(), flag);
			numbers.add(max);
			if(numbers.size() == n){
				break;
			}
			
			for(int i = 0; i < numbers.size() -1; ++i){
				int gcd = getGcd(numbers.get(i), max);
				removeGcd(list, numbers.size(), flag, gcd);				

			}
		}
		
		
		for(int i = 0; i < numbers.size(); ++i){
			System.out.print(numbers.get(i));
			if(i < numbers.size()-1){
				System.out.print(" ");
			}
		}
		System.out.println();
		sc.close();		
		return;
	}
	
	public static int getMax(List<Integer> list, int startindex, boolean[] flag){
		while(flag[startindex]){
			startindex++;
		}
		flag[startindex] = true;
		return list.get(startindex);
	}
	
	private static int getGcd(int big, int small){
		 int rem = big % small;
		 if(rem == 0){
			 return small;
		 }
		 else if(rem == 1){
			 return 1;
		 }
		 else{
			 return getGcd(small, rem);
		 }
	}
	
	private static void removeGcd(List<Integer> list, int startindex, boolean[] flag, int gcd){
		int count = 0;
		for(int i = startindex; i < list.size(); ++i){
			if(!flag[i] && list.get(i) == gcd){
				flag[i] = true;
				count++;
				
				if(count == 2){
					break;
				}
			}
		}
	}
	*/
	
/*	
	public static void oldTLE(){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		int sqn = n * n;
		int[] list = new int[sqn];
		boolean[] flag = new boolean[sqn];
		
		List<Integer> numbers = new ArrayList<Integer>();
		
		int max = 0;
		int maxindex = 0;
		
		for(int i = 0; i < sqn; ++i){
			list[i] = sc.nextInt();
			
			if(list[i] > max){
				max = list[i];
				maxindex = i;
			}
		}
		flag[maxindex] = true;
		numbers.add(max);
		
		while(numbers.size() < n){
			int nextmax = getMax(list, flag);
			numbers.add(nextmax);
			
			if(numbers.size() == n){
				break;
			}
			
			for(int i = 0; i < numbers.size() -1; ++i){
				int gcd = getGcd(numbers.get(i), nextmax);
				removeGcd(list, flag, gcd);				
			}
		}

		for(int i = 0; i < numbers.size(); ++i){
			System.out.print(numbers.get(i));
			if(i < numbers.size()-1){
				System.out.print(" ");
			}
		}
		
		
		System.out.println();
		sc.close();
		
		return;
		
	}
	
	private static int getGcd(int big, int small){
		 int rem = big % small;
		 if(rem == 0){
			 return small;
		 }
		 else if(rem == 1){
			 return 1;
		 }
		 else{
			 return getGcd(small, rem);
		 }
	}
	
	private static void removeGcd(int[] list, boolean[] flag, int gcd){
		int count = 0;
		for(int i = 0; i < list.length; ++i){
			if(!flag[i] && list[i] == gcd){
				flag[i] = true;
				count++;
				
				if(count == 2){
					break;
				}
			}
		}
	}
	
	private static int getMax(int[] list, boolean[] flag){
		int max = 0;
		int index = 0;
		for(int i = 0; i < list.length; ++i){
			if(!flag[i] && list[i] > max){
				max = list[i];
				index = i;
			}
		}
		
		flag[index] = true;
		return max;
	}
*/
}
