#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int main()
{
long long n;
while (cin >> n) {
vector<int> re; //所有素数存放在这里
for (int j = 2; j < n; ++j) {
bool t = true;
for (int i = 2; i <= sqrt(j); ++i) {
if (j % i == 0) {
t = false;
break;
}
}
if (t) re.push_back(j);
}
int count = 0;
for (int i = 0; i < re.size(); ++i) {
if ((re[i] - 1) % 10 == 0) { //个位为1则输出
if (count != 0) cout << " "; //第一个输出前不加空格
cout << re[i];
count++;
}
}
cout << endl;
}
}