import java.io.*;
import java.util.*;

public class Gen {

	static int done = 0;
	static ArrayList<Integer> data = new ArrayList<Integer>();

	static final Random rand = new Random(556668949239L);
	static final int maxai = (int) 1e9;
	static final int maxn = 5000;

	static void print() throws IOException {
		done++;
		System.err.println(done);
		PrintWriter out;
		if (done < 10)
			out = new PrintWriter("../tests/0" + String.valueOf(done));
		else
			out = new PrintWriter("../tests/" + String.valueOf(done));

		out.println(data.size());
		for (int i = 0; i < data.size(); i++) {
			if (i < data.size() - 1)
				out.print(data.get(i) + " ");
			else
				out.print(data.get(i));
		}
		out.println();
		data.clear();
		out.close();
	}

	static void genIncreasingSequance(int len) throws IOException {
		for (int i = 0; i < len; i++) {
			data.add(i + 1);
		}

		print();
	}
	
	static void genReversePermutation(int len) throws IOException {
		for (int i = 0; i < len; i++) {
			data.add(len - i);
		}

		print();
	}

	static void genRandomPermutation(int len) throws IOException {
		int[] a = new int[len];
		for (int i = 0; i < len; i++)
			a[i] = i + 1;
		for (int i = 0; i < len; i++) {
			int change = rand.nextInt(i + 1);
			if (change != i + 1) {
				int tmp = a[i];
				a[i] = a[change];
				a[change] = tmp;
			}
		}
		for (int i = 0; i < len; i++) {
			data.add(a[i]);
		}

		print();
	}


	static void genSample1() throws IOException {
		data.add(4);
		data.add(3);
		data.add(2);
		data.add(5);
		data.add(1);

		print();
	}

	static void genSample2() throws IOException {
		data.add(4);
		data.add(2);
		data.add(3);
		data.add(5);
		data.add(1);

		print();
	}

	public static void main(String[] args) throws IOException {
		File dir = new File("../tests");
		if (!dir.exists())
			dir.mkdir();
		done = 0;
		genSample1();
		genSample2();
		for (int i = 10; i <= 100000; i *= 10)
			genIncreasingSequance(i);
		for (int i = 10; i <= 100000; i *= 10)
			genReversePermutation(i);
		for (int i = 10; i <= 100000; i *= 10)
			genRandomPermutation(100000);
		for (int test = 0; test < 5; test++)
			genReversePermutation(10000 + rand.nextInt(90000));
		for (int test = 0; test < 10; test++)
			genRandomPermutation(100000);
		return;
	}
}