#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, N = 1e5 + 10, mx = 0;
cin >> n;
vector<int> a(n + 1), vis(N), p(N), ans(N, 1);
for (int i = 1; i <= n; i++){
cin >> a[i];
vis[a[i]]++;
mx = max(mx, a[i]);
}
for (int i = 2; i <= mx; i++){
if (p[i] != 1 && vis[i]){
vector<int> tmp;
for (int j = i; j <= mx; j += i){
p[j] = 1;
int x = vis[j];
if (vis[j]){
while (x){
tmp.push_back(j);
x--;
}
}
}
int x = tmp.size();
for (int k = 0; k < x; k++){
ans[k + 1] = max(ans[k + 1], tmp[x - k - 1]);
}
}
}
if (mx == 0){
for (int i = 1; i <= n; i++){
cout << mx << ' ';
}
return 0;
}
if (mx == 1){
for (int i = 1; i <= n; i++){
cout << mx << ' ';
}
return 0;
}
for (int i = 1; i <= n; i++){
cout << ans[i] << ' ';
}
cout << endl;
}