#include<bits/stdc++.h>
using namespace std;
bool isPrime(long long x){
if(x%2==0 || x==1 ||x==0) return false;
else {
for(int i=3;i<=sqrt(x);i+=2){
if(x%i==0) return false;
}
}
return true;
}
int main()
{
long long a[110],n;
cin>>n;
for(int i=0;i<n;i++){
cin>>a[i];
if(isPrime(a[i])) cout<<a[i]<<" ";
}
return 0;
}