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

#define MAX 30000

bool seen[MAX];
int unseen = 1;

#define P 3
bool smooth[MAX];

int other(int p) {
	seen[p] = true;
	while (seen[unseen]) {
		unseen++;
	}
	for (int v=unseen; p+v<MAX; v++) {
		if (!seen[v] && smooth[p+v]) {
			return v;
		}
	}
	fprintf(stderr, "*** the end\n");
	exit(1);
}

int main() {
	memset(seen, 0, sizeof(seen));
	memset(smooth, 0, sizeof(smooth));

	smooth[1] = true;
	for (int n=1; 2*n<MAX; n++) {
		if (smooth[n]) {
			for (int k=2; k<=P && k*n<MAX; k++) {
				smooth[k*n] = true;
			}
		}
	}

	int v=1;
	for (int n=1; n<=10000; n++) {
		printf("%d %d %d\n", n, v, unseen);
		fflush(stdout);
		v = other(v);
	}

	return 0;
}