#include<iostream>
using namespace std;
int main() {
int n, v[101];
cin >> n;
for (int i = 1; i <= n; i++)
cin >> v[i];
for (int i = 1; i <= n; i++) {
int kk = 0;
for (int j = 1; j <= v[i]; j++)
if (v[i] % j == 0)
kk++;
if (kk == 2)
cout << v[i] << ' ';
}
return 0;
}