import java.io.IOException;
import java.io.PrintWriter;
import java.util.Random;

public class gen_project {

	static final int MAX = 50000;
	static final int T = (int) 1e7;
	static final int K = 40;

	public static void main(String[] args) throws IOException {
		for (int test = 3; test <= 30; test++) {
			PrintWriter out = new PrintWriter((test / 10) + "" + (test % 10));
			switch (test) {
			case 3: {
				out.println("1 1");
				out.println("1");
			}
				break;
			case 4: {
				out.println("1 1");
				out.println(T);
			}
				break;
			case 5: {
				out.println("3 1");
				out.println("1 " + T + " " + (T - 1));
				out.println("1");
				out.println("1");
			}
				break;
			case 6: {
				out.println("2 1");
				out.println("1 " + T);
				out.println("1");
			}
				break;
			case 7:
			case 8:
			case 9:
			case 10:
			case 11:
			case 12: {
				int n = (test == 10 ? Integer.highestOneBit(MAX) - 1 : MAX);
				out.println(n + " " + (test < 11 ? K : (1 + rand.nextInt(K))));
				for (int i = 1; i <= n; i++) {
					if (i > 1) {
						out.print(" ");
					}
					if (test != 9 && test != 10) {
						out.print(test == 7 ? T : (1 + rand.nextInt(T)));
					} else {
						if (2 * i <= n) {
							out.print(T - 1);
						} else {
							out.print(T);
						}
					}
				}
				out.println();
				for (int i = 2; i <= n; i++) {
					out.println(i / 2);
				}
			}
				break;
			case 13: {
				out.println(MAX + " " + K);
				for (int i = 0; i < MAX; i++) {
					if (i > 0) {
						out.print(" ");
					}
					out.print(T);
				}
				out.println();
				for (int i = 2; i <= MAX; i++) {
					out.println(i - 1);
				}
			}
				break;
			case 14: {
				int[] a = getRandPerm(MAX - 1);
				for (int i = 0; i < a.length; i++) {
					a[i] += 2;
				}
				out.println(MAX + " " + K);
				for (int i = 0; i < MAX; i++) {
					if (i > 0) {
						out.print(" ");
					}
					out.print(1 + rand.nextInt(T));
				}
				out.println();
				for (int i = 2; i <= MAX; i++) {
					out.println(a[i - 2] - 1);
				}
			}
				break;
			case 15:
			case 16:
			case 17:
			case 18: {
				int n = 1 + rand.nextInt(MAX);
				int k = 1 + rand.nextInt(K);
				if (test > 16) {
					n = MAX;
				}
				if (test % 2 == 0) {
					k = K;
				}
				int[] p = new int[n];
				int[] a = getRandPerm(n);
				boolean zero = false;
				for (int i = 0; i < a.length; i++) {
					if (a[i] == 0) {
						zero = true;
					} else if (zero) {
						p[a[i]] = a[i - 1];
					} else {
						p[a[i]] = a[i + 1];
					}
				}
				out.println(n + " " + k);
				for (int i = 0; i < n; i++) {
					if (i > 0) {
						out.print(" ");
					}
					out.print(1 + rand.nextInt(T));
				}
				out.println();
				for (int i = 1; i < p.length; i++) {
					out.println(p[i] + 1);
				}
			}
				break;
			default:
				int n = 1 + rand.nextInt(MAX);
				if (test >= 23) {
					n = MAX;
				}
				int k = 1 + rand.nextInt(K);
				if (test % 3 == 0) {
					k = K;
				}
				k = Math.min(n, k);
				int[] a = getRandPerm(n - 1);
				out.println(n + " " + k);
				for (int i = 0; i < n; i++) {
					if (i > 0) {
						out.print(" ");
					}
					out.print(1 + rand.nextInt(T));
				}
				out.println();
				int[] tree = new int[n - 1];
				for (int i = 0; i < tree.length; i++) {
					tree[i] = rand.nextInt(i + 1);
				}
				for (int i = 0; i < tree.length; i++) {
					out.println(tree[i] == 0 ? "1" : a[tree[i] - 1] + 1);
				}
				break;
			}
			out.close();
		}
	}

	private static int[] getRandPerm(int n) {
		int[] a = new int[n];
		for (int i = 0; i < a.length; i++) {
			a[i] = i;
			int j = rand.nextInt(i + 1);
			int tmp = a[i];
			a[i] = a[j];
			a[j] = tmp;
		}
		return a;
	}

	static Random rand = new Random(132532156);
}
