#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <vector>

int main(int argc, char **argv) {
	int n = atoi(argv[1]);
	srand(atoi(argv[2]));

	std::vector<int> answer(n + 1), save(n + 1);
	save[0] = 0;
	answer[0] = 1;
	
	for (int i = 1; i <= n; i++) {
		answer[i] = -1;
		for (int j = 1; j <= i; j++) {
			if (answer[i] < j * answer[i - j]) {
				answer[i] = j * answer[i - j];
				save[i] = j;
			}
		}
	}

	std::vector<int> pieces;
	int cur = n;
	int edges = 0;
	while (cur > 0) {
		pieces.push_back(save[cur]);
		edges += save[cur] * (save[cur] - 1) / 2;
		cur -= save[cur];
	}

	printf("%d %d\n", n, edges);

	int base = 1;
	for (int i = 0; i < pieces.size(); i++) {
		for (int j = 0; j < pieces[i]; j++) {
			for (int k = j + 1; k < pieces[i]; k++) {
				printf("%d %d\n", base + j, base + k);
			}
		}
		
		base += pieces[i];
	}	

	fprintf(stderr, "Comment to maxtest: %d\n", answer[n]);
	return 0;
}