import math
n= int(input())
s = 0
for a in range (1 , n + 1):
    f = True;
    for i in range (2,int(math.sqrt(a))+1):
        if a % i ==0:
            f = False;
            break;
    if f == True and a != 1:
        print(a, end = ' ')
        s += 1;
        if s == 5:
            print()
            s = 0;
/**************************************************************
	Problem: 1064
	User: admin
	Language: Python
	Result: Accepted
	Time:141 ms
	Memory:34480 kb
****************************************************************/