#include<iostream>
#include<conio.h>
using namespace std;
class FourDigitsClass
{
	private :
		int j, n;
	public :
		int Calculate(int num)
		{
			n = 0;
			for(j=1; j <= num; j++)
				if(num % j == 0)
					n++;
			if(n == 2)
				return 1;
			else
				return 0;
		}
};

int main()
{
	FourDigitsClass A;
	int i;
	for(i=1000; i <= 9999; i++)
	{
		if(A.Calculate(i) == 1)
			cout << i << " ";
	}
	getch();
}

