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

int main(int argc, char **argv) {
	int n = atoi(argv[1]);
	srand(atoi(argv[2]));
	printf("%d %d\n", n, n - 1);

	int center = rand() % n;

	std::vector<int> v;	
	for (int i = 0; i < n; i++) {
		if (i == center) continue;
		v.push_back(i);
	}		
	std::random_shuffle(v.begin(), v.end());
	for (int i = 0; i < n - 1; i++) {
		printf("%d %d\n", center + 1, v[i] + 1);
	}
	return 0;
}