import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class TestsGen 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 TestsGen()).start();
    }

    PrintWriter out;

    Random rand = new Random(64395786L);

    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++;
    }


    String randString(int len, String alpha) {
        StringBuilder ans = new StringBuilder();
        int k = alpha.length();
        for (int i = 0; i < len; i++) {
            ans.append(alpha.charAt(rand.nextInt(k)));
        }
        return ans.toString();
    }

     
   
    final String ALPHA = "abcdefghijklmnopqrstuvwxyz";
    
    
    long rand(long l, long r) {
    	return l + (rand.nextLong() >>> 1) % (r - l + 1);
    }
    
    int rand(int l, int r) {
    	return l + rand.nextInt(r - l + 1);
    }
       
    final int MAX_N = (int)1e+5;
    final int MAX = (int)1e+9;

    void genRandPossible(int n, int k) {
    	open();
    	out.println(n + " " + k);
    	for (int i = 0; i < n; ++i) {
    		out.print(rand(1, k) + " ");
    	}
    	out.println();
    	close();
    }
    
    void genRandPossibleExt(int n, int k) {
    	open();
    	out.println(n + " " + k);
    	ArrayList<Integer> a = new ArrayList<Integer>();
		int f = rand(1, n / 2);
		for (int i = 0; i < f; ++i) {
			int q = rand(1, k - 1);
			a.add(q);
			a.add(k - q);
		}
		for (int i = 2 * f; i < n; ++i) {
			a.add(rand(1, k));
		}
		Collections.shuffle(a);
		for (int i : a) {
			out.print(i + " ");
		}
		out.println();
    	close();
    }
    
    private void genRandImpossible(int n, int k) {
		open();
		out.println(n + " " + k);
		ArrayList<Integer> a = new ArrayList<Integer>();
		int f = rand(1, n);
		for (int i = 0; i < f; ++i) {
			a.add(rand(k + 1, MAX));
		}
		for (int i = f; i < n; ++i) {
			a.add(rand(1, k));
		}
		Collections.shuffle(a);
		for (int i : a) {
			out.print(i + " ");
		}
		out.println();
		close();
	}
    
    public void solve() throws IOException {
    	for (int i = 0; i < 4; ++i) {
    		genRandImpossible(rand(1, MAX_N), rand(1, MAX));
    	}
    	genRandImpossible(MAX_N, MAX - 1);
    	for (int i = 0; i < 8; ++i) {
    		genRandPossible(rand(1, MAX_N), rand(1, MAX));
    	}
    	genRandPossible(MAX_N, MAX);
    	genRandPossible(MAX_N, 1);
    	for (int i = 0; i < 9; ++i) {
    		genRandPossibleExt(rand(1, MAX_N), rand(1, MAX));
    	}
    	genRandPossibleExt(MAX_N, MAX);
    }

    

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