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

#define MAX 200000

long long vv[MAX];

int main() {
	for (long long n = 0; n<MAX; n++) {
		vv[n] = 2*n+1;
	}

	long long nb = MAX;
	for (long long i = 1; vv[i] < nb; i++) {
		long long m = vv[i];
		long long nnb = 0;
		for (long long j = 0; j<nb; j++) {
			if ((j+1)%m) {
				vv[nnb++] = vv[j];
			}
		}

		nb = nnb;
	}

	long long k = 0;
	for (long long n = 0; nb && k < 10000; n++) {
		if (vv[0]==2) {
			printf("%lld %lld\n", ++k, n);
		}

		nb--;
		for (long long i = 0; i<nb; i++) {
			vv[i] = abs(vv[i+1]-vv[i]);
		}
	}

	return 0;
}