#include<bits/stdc++.h>
using namespace std;
int n,a[100005],ii;
int zhishu(int x)
{
int q=0;
for(int j=2;j<=sqrt(x);j++)
{
if(a[ii]%j==0)
q++;
}
if(q)return 0;
else return 1;
}
int main()
{
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
ii=i;
cin>>a[i];
if(zhishu(a[i])==0)
{
a[i]=0;
}
}
for(int i=1;i<=n;i++)
{
if(a[i])
cout<<a[i]<<' ';
}
return 0;
}