#include<bits/stdc++.h>
using namespace std;

bool issushu(int a)
{
    int k = sqrt(a);
    for(int i = 2;i<=k;i++)
    {
        if(a % i == 0)
        {
            return false;
        }
    }
    return true;
}
int main()
{
    int n;
    while(cin>>n)
    {
        int k = 11;
        while(k<n)
        {
            if(issushu(k))
            {
                cout<<k<<" ";
            }
            k += 10;
        }
    }
    return 0;
}