#include <bits/stdc++.h>
using namespace std;
int main(){
	int k;
	cin>>k;
	int a=1;
	while(a<=k){
		if(a%2==0&&a%3!=0){
		cout<<a<<endl;
		}
	a++;
	}
	return 0;
}

/**************************************************************
	Problem: 1699
	User: tonghuawei
	Language: C++
	Result: Accepted
	Time:17 ms
	Memory:2072 kb
****************************************************************/