import java.io.IOException;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;

public class TestsGen {

	static Random rnd = new Random(3);
	static final int MAXN = 300000;
	static final int MAXK = 100000;

	static ArrayList<Long> primes = new ArrayList<Long>();
	static boolean[] isPrime = new boolean[MAXN];
	
	static void init() {
		Arrays.fill(isPrime, true);
		for (int i = 2; i < MAXN; i++) {
			if (isPrime[i]) {
				primes.add((long) i);
				for (int j = 2 * i; j < MAXN; j += i) {
					isPrime[j] = false;
				}
			}
		}
	}

	static class Test {
		long[] a;
		int n;

		public Test(long[] a, int n) {
			this.a = a.clone();
			this.n = n;
		}

		static int test = 1;

		void out() throws IOException {
			System.err.print(String.format("[%02d]", test));
			PrintWriter out = new PrintWriter(String.format("%02d", test++));
			out.println(n + " " + a.length);
			for (int i = 0; i < a.length; i++)
				out.print(a[i] + ((i == a.length - 1) ? "" : " "));
			out.println();
			out.close();
		}

		Test shuffle() {
			for (int i = 0; i < a.length; i++) {
				int pos = rnd.nextInt(i + 1);
				long tmp = a[i];
				a[i] = a[pos];
				a[pos] = tmp;
			}
			return new Test(a, n);
		}
	}

	static boolean isPrime(int a) {
		return BigInteger.valueOf(a).isProbablePrime(20);
	}

	static long choice(List<Long> a) {
		return a.get(rnd.nextInt(a.size()));
	}
	
	public static void main(String[] args) throws IOException {
		init();
		
		new Test(new long[] { 2 }, 2).out();
		new Test(new long[] { 2, 3, 5 }, 10).out();
		new Test(new long[] { 5, 5 }, 10).out();
		new Test(new long[] { 10 }, 10).out();
		new Test(new long[] { 7, 3 }, 10).out();

		{ // 6
			long[] a = new long[10];
			for (int i = 0; i < a.length; i++)
				a[i] = i + 2;
			new Test(a, 100).shuffle().out();
		}

		{ // 7
			long[] a = new long[1000];
			for (int i = 0; i < a.length; i++)
				a[i] = rnd.nextInt(9998) + 2;
			new Test(a, 10000).out();
		}

		{ // 8
			long[] a = new long[1000];
			for (int i = 0; i < a.length; i++)
				a[i] = i + 2;
			new Test(a, 10000).shuffle().out();
		}

		{ // 9
			long[] a = new long[1000];
			for (int i = 0, j = 2; i < a.length; j++) {
				if (isPrime(j)) {
					a[i++] = j;
				}
				assert j <= 10000;
			}
			new Test(a, 10000).shuffle().out();
		}

		{ // 10
			long[] a = new long[1000];
			for (int i = 0; i < a.length; i++) {
				a[i] = 2;
			}
			new Test(a, 10000).out();
		}

		// ===========================
		// ======= HARDCORE: =========
		// ===========================

		{ // 11
			long[] a = new long[MAXK];
			for (int i = 0; i < a.length; i++) {
				a[i] = i + 2;
			}
			new Test(a, MAXN).out();
		}

		{ // 12
			long[] a = new long[MAXK];
			int high = Math.min(a.length, primes.size());
			for (int i = 0;i < high; i++)
				a[i] = primes.get(i);
			for (int i = high; i < MAXK; i++)
				a[i] = 2 + i % 20;
			new Test(a, MAXN).out();
		}
		
		{ // 13
			long[] a = new long[MAXK];
			for (int i = 0; i < a.length; i++) {
				a[i] = 2 + i % 3;
			}
			new Test(a, MAXN).out();
		}
		
		{ // 14
			long[] a = new long[MAXK];
			for (int i = 2, pos = 0; i < MAXN && pos < a.length; i++) {
				if (i % 2 == 0 || i % 3 == 0 || i % 5 == 0) {
					a[pos++] = i;
				}
			}
			new Test(a, MAXN).out();
		}
		
		{ // 15
			long[] a = new long[MAXK];
			int high = Math.min(a.length, primes.size());
			for (int i = 0;i < high; i++)
				a[i] = primes.get(high - i - 1);
			for (int i = high; i < MAXK; i++)
				a[i] = rnd.nextInt(20) + 2;
			new Test(a, MAXN).out();
		}
		
		{ // 16
			long[] a = new long[MAXK];
			for (int i = 0; i < a.length / 5 * 4; i++)
				a[i] = i + MAXN - MAXK;
			for (int i = a.length / 5 * 4; i < a.length; i++)
				a[i] = rnd.nextInt(20) + 2;
			new Test(a, MAXN).shuffle().out();
		}
		
		{ // 17
			long[] a = new long[MAXK];
			for (int i = 0; i < a.length; i++) 
				a[i] = rnd.nextInt(MAXN - 2) + 2;
			new Test(a, MAXN).out();
		}
		
		{ // 18
			long[] a = new long[MAXK];
			for (int i = 0; i < a.length; i++) {
				long now;
				while ((now = choice(primes) * choice(primes.subList(0, 6))) > MAXN)
					;
				a[i] = now;
			}
			for (int i = a.length / 5 * 4; i < a.length; i++)
				a[i] = rnd.nextInt(20) + 2;
			new Test(a, MAXN).out();
		}
		
		{ // 19
			long[] a = new long[MAXK];
            Arrays.fill(a, 2);
			for (int i = 0, pos = 0; i < primes.size() && pos < a.length; i++) {
				long now;
				for (int j = 0; pos < a.length && (now = primes.get(i) * primes.get(j)) <= MAXN; j++, pos++) {
					a[pos] = now;
				}
			}
			for (int i = a.length / 5 * 4; i < a.length; i++)
				a[i] = rnd.nextInt(20) + 2;
			new Test(a, MAXN).out();
		}
		
		{ // 20
			long[] a = new long[MAXK];
			for (int i = 0; i < a.length; i++) {
				a[i] = rnd.nextInt(MAXK - 2) + 2;
			}
			for (int i = 0; i < a.length / 5 * 4; i++)
				a[i] = rnd.nextInt(20) + 2;
    		new Test(a, MAXN).out();
		}
	}
}
