#include using namespace std; void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } int main() { fast_io(); int n; cin >> n; vector a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } int M = *max_element(a.begin(), a.end()); vector cnt(M + 1); for (int i = 0; i < n; i++) { cnt[a[i]]++; } vector cnt_mul(M + 1); for (int i = 1; i <= M; i++) { for (int j = i; j <= M; j += i) { cnt_mul[i] += cnt[j]; } } vector ans(n + 1); for (int i = 1; i <= M; i++) { ans[n - cnt_mul[i]] = i; } for (int i = 0; i < n; i++) { if (i > 0) { ans[i] = max(ans[i], ans[i - 1]); } cout << ans[i] << "\n"; } }