#include<stdio.h>
int main (){
int n;
while (scanf("%d", &n)!=EOF && n!=0){
int i;
for (i=1; i<n; i++){
if (i%7!=0) printf("%d ", i);
}
printf("\n");
return 0;