#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
int main(){
	int n, m = 0; cin >> n;
	for(; m < n; m=m*2+1);
	rep(i,n){
		int t = i*2, u = t+1;
		while(t >= n) t -= 1 << (31 - __builtin_clz(t));
		while(u >= n) u -= 1 << (31 - __builtin_clz(u));
		cout << t+1 << " " << u+1 << "\n";
	}
}
#include <cstdio>

int N, M;

int main() {
	scanf("%d", &N);
	for (M = 1; M < N; M <<= 1) ;
	for (int i = 0; i < N; ++i) {
		int x = i << 1;
		int y = x | 1;
		x &= M - 1;
		y &= M - 1;
		if (x >= N) x ^= M >> 1;
		if (y >= N) y ^= M >> 1;
		printf("%d %d\n", x + 1, y + 1);
	}
	return 0;
}