#include <bits/stdc++.h>

using namespace std;

int main() {
	ios_base::sync_with_stdio(0);
	multiset<int> ms;
	multiset<int>::iterator it;
	int n, x;
	cin >> n;
	for (int i = 0; i < n * n; i++) {
		cin >> x;
		ms.insert(x);
	}
	int sz = n - 1;
	vector<int> res;
	while (true) {
		vector<int> tmp;
		int last = *--ms.end();
		res.push_back(last);
		ms.erase(--ms.end());
		if (res.size() == n) break;
		for (int i = 0; i < sz; i++) {
			tmp.push_back(*--ms.end());
			ms.erase(--ms.end());
			it = ms.lower_bound(__gcd(last, tmp[i]));
			if (it != ms.end()) ms.erase(it);
			it = ms.lower_bound(__gcd(last, tmp[i]));
			if (it != ms.end()) ms.erase(it);
		}
		for (int i = 0; i < tmp.size(); i++) {
			ms.insert(tmp[i]);
		}
		sz--;
	}
	for (int i = 0; i < res.size(); i++) 
		cout << res[i] << ' ';
	
	return 0;
}