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

public class TestGen {
	public static void main(String[] args) {
		new TestGen().run();
	}

	BufferedReader br;
	StringTokenizer in;
	PrintWriter out;

	public String nextToken() throws IOException {
		while (in == null || !in.hasMoreTokens()) {
			in = new StringTokenizer(br.readLine());
		}
		return in.nextToken();
	}

	public int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	public long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	int tNumber;
	Random rnd;

	class Test {
		ArrayList<Integer> a, b;
		int n, m;

		public void printTest() throws IOException {
			if (tNumber < 10)
				out = new PrintWriter("0" + tNumber);
			else
				out = new PrintWriter("" + tNumber);
			tNumber++;
			out.println(n);
			Collections.shuffle(a, rnd);
			for (int i = 0; i < n; i++) {
				out.print(a.get(i));
				if (i < n - 1)
					out.print(' ');
				else
					out.println();
			}
			out.println(m);
			for (int i = 0; i < m; i++) {
				out.print(b.get(i));
				if (i < m - 1)
					out.print(' ');
				else
					out.println();
			}
			out.close();
			spoilTest();
		}

		public void doRandTest(int maxN, int maxM, int maxT) throws IOException {
			n = rnd.nextInt(maxN) + 1;
			m = rnd.nextInt(maxM) + 1;
			a = new ArrayList<Integer>();
			for (int i = 0; i < n; i++)
				a.add(rnd.nextInt(maxT) + 1);
			b = new ArrayList<Integer>();
			for (int i = 0; i < m; i++)
				b.add(rnd.nextInt(maxT) + 1);
			printTest();
		}

		public void doFullTest(int N, int M, int t) throws IOException {
			n = N;
			m = M;
			a = new ArrayList<Integer>();
			b = new ArrayList<Integer>();
			for (int i = 0; i < n; i++)
				a.add(t);
			for (int i = 0; i < m; i++)
				if (t > m)
					b.add(rnd.nextInt(t - m) + 1);
				else
					b.add(1);
			printTest();
		}

		public void doEmptyTest(int N, int M, int t)
				throws IOException {
			n = N;
			m = M;
			if (t == (int)1e9)
				t--;
			a = new ArrayList<Integer>();
			for (int i = 0; i < n; i++) {
				a.add(rnd.nextInt(t) + 1);
			}
			b = new ArrayList<Integer>();
			for (int i = 0; i < m; i++) {
				b.add(rnd.nextInt((int)1e9 - t) + t + 1);
			}
			printTest();
		}

		public void doInterestingTest(int N, int M) throws IOException {
			n = N;
			m = M;
			a = new ArrayList<Integer>();
			for (int i = 0; i < n; i++) {
				a.add(m - rnd.nextInt(m / 10));
			}
			b = new ArrayList<Integer>();
			for (int i = m; i >= 1; i--) {
				b.add(i + rnd.nextInt(n) - n / 2);
				if (b.get(m - i) <= 0)
					b.set(m - i, 1);
				if (b.get(m - i) > 1e9)
					b.set(m - i, (int)1e9);
			}
			printTest();
		}

		public void spoilTest() {
			if (rnd.nextInt(3) > 0)
				return;
			for (int i = 0; i < n; i++) {
				if (rnd.nextInt(3) > 0)
					continue;
				a.set(i, rnd.nextInt((int) 1e9) + 1);
			}
			for (int i = 0; i < m; i++) {
				if (rnd.nextInt(3) > 0)
					continue;
				b.set(i, rnd.nextInt((int) 1e9) + 1);
			}
		}
	}

	public void solve() throws IOException {
		tNumber = 2;
		rnd = new Random(31);
		Test t = new Test();
		
		
		t.doRandTest(10 + rnd.nextInt(5), rnd.nextInt(5) + 10,
				(int)1e9);
		
		t.doRandTest(100 + rnd.nextInt(50), rnd.nextInt(50) + 100,
				rnd.nextInt(50) + 100);
		
		t.doRandTest(1000 + rnd.nextInt(500), rnd.nextInt(500) + 1000,
				(int)1e9);
		
		t.doRandTest(10000 + rnd.nextInt(5000), rnd.nextInt(5000) + 10000,
				rnd.nextInt(5000) + 10000);
		
		t.doRandTest(75000 + rnd.nextInt(25000), rnd.nextInt(25000) + 75000,
				rnd.nextInt(25000) + 75000);
		
		t.doFullTest(10 + rnd.nextInt(5), rnd.nextInt(5) + 10,
				rnd.nextInt(5) + 10);
		
		t.doFullTest(100 + rnd.nextInt(50), rnd.nextInt(50) + 100,
				(int)1e9);
		
		t.doFullTest(1000 + rnd.nextInt(500), rnd.nextInt(500) + 1000,
				rnd.nextInt(500) + 1000);
		
		t.doFullTest(10000 + rnd.nextInt(5000), rnd.nextInt(5000) + 10000,
				rnd.nextInt(5000) + 10000);
		
		t.doFullTest(75000 + rnd.nextInt(25000), rnd.nextInt(25000) + 75000,
				rnd.nextInt(25000) + 75000);
		
		t.doEmptyTest(10 + rnd.nextInt(5), rnd.nextInt(5) + 10,
				(int)1e9);
		
		t.doEmptyTest(100 + rnd.nextInt(50), rnd.nextInt(50) + 100,
				rnd.nextInt(50) + 100);
		
		t.doEmptyTest(1000 + rnd.nextInt(500), rnd.nextInt(500) + 1000,
				rnd.nextInt(500) + 1000);
		
		t.doEmptyTest(10000 + rnd.nextInt(5000), rnd.nextInt(5000) + 10000,
				rnd.nextInt(5000) + 10000);
		
		t.doEmptyTest(75000 + rnd.nextInt(25000), rnd.nextInt(25000) + 75000,
				(int)(1e9));
		
		t.doInterestingTest(10 + rnd.nextInt(5), rnd.nextInt(5) + 10);
		
		t.doInterestingTest(100 + rnd.nextInt(50), rnd.nextInt(50) + 100);
		
		t.doInterestingTest(10000 + rnd.nextInt(5000), rnd.nextInt(5000) + 10000);
		
		t.doInterestingTest(75000 + rnd.nextInt(25000), rnd.nextInt(25000) + 75000);
		
	}

	public void run() {
		try {
			// br = new BufferedReader(new FileReader("TestGen.in"));
			// out = new PrintWriter("TestGen.out");
			// br = new BufferedReader(new InputStreamReader(System.in));
			// out = new PrintWriter(System.out);

			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(1);
		}
	}
}