#include <stdio.h>
#include <string.h>
#include <stdlib.h>

long long gcd(long long a, long long b) {
	while (a != 0) {
		long long c = a;
		a = b%a;
		b = c;
	}
	return (b<0) ? -b : +b;
}

#define RING (1LL<<(sizeof(unsigned short)*8))
bool seen[RING];

unsigned short slow = 0;
long long low = 0;
long long high = RING;

long long other(long long p) {
	while (seen[slow]) {
		seen[slow] = false;
		slow++;
		low++;
		high++;
	}

	long long p1 = p+1;
	long long m1 = p-1;

	long long v=low;
	unsigned short sv=slow;
	while (v<high) {
		if (!seen[sv] && gcd(p,v)==1 && v!=p1 && v!=m1) {
			seen[sv] = true;
			return v;
		}

		sv++;
		v++;
	}

	exit(1);
}

int main() {
	memset(seen, 0, sizeof(seen));
	seen[0] = true;
	seen[1] = true;

	long long k=0;
	long long v=1;
	for (long long n=1;; n++) {
		bool odd = v%2;
		v = other(v);
		if (odd && (v%2)) {
			printf("%lld %lld\n", ++k, n);
			fflush(stdout);
		}
	}

	return 0;
}