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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Random;

public class C {

	static Random rand = new Random();

	public static void main(String[] args) throws Exception {

		long start = System.currentTimeMillis();

		// int N = 500;
		//
		// int[] a = new int[N];
		// for (int i = 0; i < a.length; i++) {
		// a[i] = rand.nextInt(10) + 1;
		// }
		//
		// List<Integer> gcds = new ArrayList<Integer>();
		// for (int i = 0; i < a.length; i++) {
		// for (int j = 0; j < a.length; j++) {
		// gcds.add(gcd(a[i], a[j]));
		// }
		// }
		// shuffle(gcds);
		// Arrays.sort(a);

		int N = readIntArray()[0];
		int[] gcda = readIntArray();
		List<Integer> gcds = new ArrayList<Integer>();
		for (int i = 0; i < gcda.length; i++) {
			gcds.add(gcda[i]);
		}

		// print(gcds);
		// System.out.println(Arrays.toString(a));
		// // System.out.println("-----------------------");
		// HashSet<Integer> distinct = new HashSet<Integer>();
		// for (int i = 0; i < gcds.size(); i++) {
		// distinct.add(gcds.get(i));
		// }

		// int[] distinctArr = new int[distinct.size()];
		// Iterator<Integer> it = distinct.iterator();
		// int i = 0;
		// while(it.hasNext()) {
		// distinctArr[i++] = it.next();
		// }

		// System.out.println(Arrays.toString(distinctArr));
		// HashMap<Integer, Integer> hist = new HashMap<Integer, Integer>();
		// for (int gcd : gcds) {
		// inc(hist, gcd);
		// }

		// for(int key : hist.keySet()) {
		// System.out.println(key + " " + hist.get(key));
		// }

		Collections.sort(gcds, new ReverseComparator());
		gcds.add(0); // sentinel
		int[] res = new int[N];
		int resi = 0;
		int last = gcds.get(0);
		int cnt = 0;
		HashMap<Integer, Integer> gcdsCnt = new HashMap<Integer, Integer>();
		for (int j = 0; j < gcds.size(); j++) {
			if (gcds.get(j) == last) {
				cnt++;
			} else {
				int cnt2 = cnt;
				if (gcdsCnt.containsKey(last)) {
					cnt2 -= gcdsCnt.get(last);
				}
				// for (int j2 = 0; j2 < resi; j2++) {
				// for (int k = 0; k < resi; k++) {
				// int gcd = gcd(res[j2], res[k]);
				// if (gcd == last) {
				// cnt2-=1;
				// }
				// }
				// }

				if (cnt2 > 0) {
					int cnt3 = 0;
					for (int k = 0; k < resi; k++) {
						int gcd = gcd(res[k], last);
						if (gcd == last) {
							cnt3++;
						}
					}

					int newcnt = 0;
					for (int k = 1; k < N + 1; k++) {
						if (k * k + 2 * k * cnt3 == cnt2) {
							newcnt = k;
							break;
						}
					}

					for (int k = 0; k < resi; k++) {
						int gcd = gcd(res[k], last);
						inc(gcdsCnt, gcd, newcnt*2);
					}

					for (int k = 0; k < newcnt; k++) {
						res[resi++] = last;
					}
				}

				last = gcds.get(j);
				j--;
				cnt = 0;
			}
		}

		Arrays.sort(res);
		// System.out.println(Arrays.toString(res));

		// if (Arrays.toString(a).equals(Arrays.toString(res))) {
		// System.out.println("OK");
		// } else {
		// System.out.println("WRONG");
		// }

		print(res);

		// System.out.println(System.currentTimeMillis() - start);
	}

	static void print(int[] a) {
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < a.length; i++) {
			if (sb.length() > 0) {
				sb.append(' ');
			}

			sb.append(a[i]);
		}

		System.out.println(sb);
	}

	static class ReverseComparator implements Comparator<Integer> {

		@Override
		public int compare(Integer arg0, Integer arg1) {
			return -arg0.compareTo(arg1);
		}

	}

	static void inc(HashMap<Integer, Integer> map, int key, int val) {
		if (!map.containsKey(key)) {
			map.put(key, val);
		} else {
			map.put(key, map.get(key) + val);
		}
	}

	static void inc(HashMap<Integer, Integer> map, int key) {
		inc(map, key, 1);
	}

	static int gcd(int a, int b) {

		if (a < b)
			return gcd(b, a);

		do {
			// a = gcd * z * x + y
			// b = gcd * z
			int t = a % b;
			a = b;
			b = t;
		} while (b > 0);

		return a;
	}

	static void shuffle(List<Integer> a) {
		for (int i = 0; i < a.size(); i++) {
			int j = rand.nextInt(a.size() - i);
			swap(a, i, i + j);
		}
	}

	static void swap(List<Integer> a, int i, int j) {
		int x = a.get(i);
		a.set(i, a.get(j));
		a.set(j, x);
	}

	static void append(StringBuilder sb, int val) {
		if (sb.length() > 0) {
			sb.append('\n');
		}

		sb.append(val);
	}

	static InputStreamReader isr = new InputStreamReader(System.in);
	static BufferedReader br = new BufferedReader(isr);
	static StringBuilder sb = new StringBuilder();

	static String readNextToken() throws IOException {
		sb.setLength(0);
		char c = ' ';
		do {
			c = ((char) br.read());
			if (Character.isWhitespace(c)) {
				if (sb.length() > 0) {
					break;
				}
			} else {
				sb.append(c);
			}
		} while (true);

		return sb.toString();
	}

	static int ni() throws Exception {
		return Integer.parseInt(readNextToken());
	}

	static long nl() throws Exception {
		return Long.parseLong(readNextToken());
	}

	static int[] readIntArray() throws IOException {

		String[] v = br.readLine().split(" ");
		int[] ans = new int[v.length];

		for (int i = 0; i < ans.length; i++) {
			ans[i] = Integer.valueOf(v[i]);
		}

		return ans;
	}

	static long[] readLongArray() throws IOException {
		String[] v = br.readLine().split(" ");
		long[] ans = new long[v.length];

		for (int i = 0; i < ans.length; i++) {
			ans[i] = Long.valueOf(v[i]);
		}

		return ans;
	}

	static <T> void print(List<T> v) {
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < v.size(); i++) {
			if (sb.length() > 0) {
				sb.append(' ');
			}

			sb.append(v.get(i));
		}

		System.out.println(sb);
	}
}
