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