#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m,k,l;
	for(int i=1;i<500;i++){
    	if(i%3==2&&i%5==3&&i%7==2){
    		cout<<i<<endl;
		}
	}
    

   
}
/**************************************************************
	Problem: 1021
	User: zhengzihao
	Language: C++
	Result: Accepted
	Time:4 ms
	Memory:2072 kb
****************************************************************/