#include <iostream>
#include<math.h>
using namespace std;
//求素数
bool SuNum(int x) {
bool tag0 = true;
if (x == 2 || x == 3) {
return true;
}
for (int i = 2; i <= (int)sqrt(x); i++) {
if (x % i == 0) {
tag0 = false;
}
}
return tag0;
}
//判定个位是否为1
bool isOne(int x) {
if (x % 10 == 1) return true;
return false;
}
int main() {
int x, tag = -1;
while (scanf("%d", &x) != EOF) {
for (int i = 2; i < x; i++) {
if (SuNum(i) && isOne(i)) {
cout << i << " ";
tag = 0;
}
}
if (tag == -1) cout << tag;
}
return 0;
}