#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long int
#define YES cout<<"YES\n"
#define NO cout<<"NO\n"
#define endl "\n"
vector<int> takeVectorInput(int n){
vector<int>v(n);
for(auto &ele:v)cin>>ele;
// vector<int>v(n+1);
// for(int i=1;i<=n;++i) {
// cin>>v[i];
// }
return v;
}
void solve(){
int n;
cin>>n;
auto v=takeVectorInput(n);
vector<int> ans(n+1,1);
for(int i=1;i<=1e5;++i){
int cnt=0;
for(int j=0;j<n;++j){
if(v[j]%i==0)cnt++;
}
ans[cnt]=max(ans[cnt],i);
}
int gc=0;
for(auto &ele:v)gc=__gcd(gc,ele);
ans[n]=max(ans[n],gc);
for(int i=n-1;i>=1;--i)ans[i]=max(ans[i+1],ans[i]);
int maxi=*max_element(v.begin(),v.end());
int cnt=count(v.begin(),v.end(),0);
if(cnt>0){
for(int i=1;i<=cnt+(cnt<n?1:0);++i)cout<<maxi<<" ";
for(int i=cnt+2;i<=n;++i)cout<<ans[i]<<" ";
cout<<endl;
return;
}
for(int i=1;i<=n;++i)cout<<ans[i]<<" ";
cout<<endl;
}
signed main(){
fast
int t=1;
// cin>>t;
while(t--){
solve();
}
}