#include<bits/stdc++.h>
using namespace std;
int main(){
int s=1;
while(s<=500){
if(s%3==2&&s%5==3&&s%7==2){
cout<<s<<endl;
}
s++;
}
return 0;
}
/**************************************************************
Problem: 1021
User: huangcanwu
Language: C++
Result: Accepted
Time:10 ms
Memory:2072 kb
****************************************************************/