// Tests generator for Guitar problem
// Author : Vladimir Ulyantsev, ulyantsev@rain.ifmo.ru

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

public class GuitarTestsGen implements Runnable {
    public static void main(String[] args) {
        if (args.length < 1) {
        	for (I = 1; (new File(getName(I) + ".t")).exists(); I++);
        } else {
            I = Integer.parseInt(args[0]);
        }
        new Thread(new GuitarTestsGen()).start();
    }

    PrintWriter out;

    Random random = new Random(6466403L);

    static int I;

    static String getName(int i) {
    	return ((i < 10) ? "0" : "") + i;
    }
    
    void open() {
        try {
        	System.out.println("Generating test " + I);
            out = new PrintWriter(getName(I));
        } catch (FileNotFoundException e) {        	
        	e.printStackTrace();
        	System.exit(-1);
        }
    }

    void close() {
        out.close();
        I++;
    }

    final int maxn = 10000;
    final int maxk = 1000;
    final int maxx = 1000000000;

    void genIncrease(int n, int k, int l, int r) {
    	open();
    	
    	out.println(n + " " + k);
    	int[] arr = new int[n];
    	for (int i = 0; i < n; i++) {
        	arr[i] = l + random.nextInt(r - l + 1);
       	}

       	Arrays.sort(arr);

    	for (int i = 0; i < n; i++) {
    		if (i > 0)
    			out.print(" ");
    		out.print(arr[r > l ? i : n - i - 1]);
    	}
    	out.println();

    	close();
    }

    void genRandom(int n, int k, int l, int r) {
    	open();
    	
    	out.println(n + " " + k);
    	int[] arr = new int[n];
    	for (int i = 0; i < n; i++) {
        	arr[i] = l + random.nextInt(r - l + 1);
       	}

    	for (int i = 0; i < n; i++) {
    		if (i > 0)
    			out.print(" ");
    		out.print(arr[i]);
    	}
    	out.println();

    	close();
    }

    void genGreedy(int n, int k, int l, int r) {
    	open();
    	
    	out.println(n + " " + k);
    	int[] arr = new int[n];
    	for (int i = 0; i < n / 2; i++) {
        	arr[i] = l + random.nextInt(r - l + 1);
       	}
       	
       	for (int i = n / 2; i < n; i++) {
        	arr[i] = r - random.nextInt(100);
       	}

    	for (int i = 0; i < n; i++) {
    		if (i > 0)
    			out.print(" ");
    		out.print(arr[i]);
    	}
    	out.println();

    	close();
    }

    public void solve() throws IOException {
		for (int i = 0; i < 6; i++) {
			genIncrease(20, 1 + random.nextInt(20), 1, 10000);
		}
		for (int i = 0; i < 2; i++) {
			genRandom(1 + random.nextInt(maxn), 1 + random.nextInt(maxk), -maxx, maxx);
		}
		for (int i = 0; i < 6; i++) {
			genGreedy(maxn, 1 + random.nextInt(maxk), -maxx, maxx);
		}
		for (int i = 0; i < 6; i++) {
			genGreedy(maxn, maxk, -maxx, maxx);
		}
    }

    public void run() {
        try {
            solve();
        } catch (Throwable e) {
            e.printStackTrace();
            System.exit(-1);
        }
    }
}
