// Author: Adrian Kuegel
// Algorithm: Brute force (too slow)

#include <stdio.h>
#include <algorithm>
using namespace std;

int p[1000000];

int main() {
	int n;
//	freopen("cyclic.in", "r", stdin);
	while(scanf("%d", &n) == 1 && n) {
		for (int i=0; i<n; ++i)
			p[i] = i;
		do {
			bool valid = true;
			for (int i=1; i+1<n; ++i)
				if ((p[i] < p[i-1]) == (p[i+1] < p[i]))
					valid = false;
			int xp = 0;
			int cnt = 0;
			do {
				xp = p[xp];
				++cnt;
			}while(xp);
			if (cnt == n && valid) {
				for (int i=0; i<n; ++i)
					printf("%d ", p[i]+1);
				puts("");
				break;
			}
		}while(next_permutation(p, p+n));
	}
	return 0;
}
