// Author:     Adrian Kuegel
// Algorithm:  Dynamic programming
// Complexity: O(n) time + space
// Date:       June 9th, 2009

#include <stdio.h>
#include <assert.h>

#define MAXN 1000000

int ind[MAXN+1], p[MAXN+1];

int main() {
	int n;
//	freopen("cyclic.in", "r", stdin);
	while(scanf("%d", &n) == 1 && n) {
		assert(n >= 1 && n <= MAXN);
		if (n == 1) {
			puts("1");
			continue;
		}
		p[1] = 2;
		p[2] = 1;
		ind[1] = 2;
		ind[2] = 1;
		int i;
		for (i=4; i<=n; i+=2) {
			// find position of i/2
			int pos = ind[i/2];
			p[i-1] = i;
			p[i] = i/2;
			p[pos] = i-1;
	//		ind[i/2] = i;
			ind[i] = i-1;
			ind[i-1] = pos;
		}
		if (n&1) {
			int pos = ind[(n+1)/2];
			p[pos] = n;
			p[n] = (n+1)/2;
		}
		for (int i=1; i<=n; ++i) {
			if (i > 1)
				printf(" ");
			printf("%d", p[i]);
		}
		puts("");
	}
	return 0;
}
