import sysfor x in sys.stdin: if x == "0": break a=range(int(x)) y=[] for i in a: if i%7!=0: y.append(i) print(*y,sep=" ")