/**
* author: Binoy Barman
* created: 2025-01-02 21:00:22
**/
#include<bits/stdc++.h>
#ifdef LOCAL
#include "debug/trace.hpp"
#else
#define dbg(...) 42
#define print(...) 42
#endif
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int inf = 1e9;
#define int long long
#define nl '\n'
#define all(v) v.begin(), v.end()
#define Testcase_Handler int tts, tc = 1; cin >> tts; hell: while(tts--)
#define uniq(v) sort(all(v)), v.resize(distance(v.begin(), unique(v.begin(), v.end())))
template<class T> using minheap = priority_queue<T, vector<T>, greater<T>>;
template<typename T> istream& operator>>(istream& in, vector<T>& a) {for(auto &x : a) in >> x; return in;};
template<typename T> ostream& operator<<(ostream& out, vector<T>& a) {bool first = true;for(auto &x : a) {if(!first) out << ' ';first = false;out << x;}return out;};
namespace Dark_Lord_Binoy {
void preprocess() {}
void setup() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
preprocess();
#ifdef LOCAL
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}
}
const int N = 1e5 + 9;
vector<int> divisors[N];
void sieve() {
for (int i = 1; i < N; i++) {
for (int j = i; j < N; j += i) {
divisors[j].push_back(i);
}
}
}
int32_t main() {
Dark_Lord_Binoy::setup();
sieve();
int n;
cin >> n;
vector<int> f(N);
for (int i = 1; i <= n; i++) {
int x;
cin >> x;
for(auto d : divisors[x]) {
f[d]++;
}
}
set<int> s;
vector<int> val(N), ans(n + 1);
for (int i = N - 1; i > 0; i--) {
if(f[i] != 0 && s.find(f[i]) == s.end()) {
s.insert(f[i]);
val[f[i]] = i;
}
}
int pre = 0;
for (int i = N - 1; i > 0; i--) {
if(val[i]) dbg(i, val[i]);
pre = max(pre, val[i]);
if(i <= n) ans[i] = pre;
}
pre = 0;
for (int i = 1; i <= n; i++) {
cout << (ans[i] != 0 ? ans[i] : pre) << " ";
pre = ans[i];
}
cout << nl;
print(_Time_);
return 0;
}