#15427: Python


NeiR (Arutoria White)


while True:
n = int(input())
if n==0:
break
else:
print(' '.join([str(n) for n in range(0,n) if n%7!=0]))