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

public class TestGen {

    static PrintWriter out;
    static Random rnd = new Random(0);
    static int tNumber;
    static void printTest(ArrayList<Integer> points) throws IOException {
        if (tNumber < 10)
            out = new PrintWriter("../tests/0" + tNumber);
        else
            out = new PrintWriter("../tests/" + tNumber);
        tNumber++;               
        out.println(points.size() + " " + randFromTo(1, points.size()));
        for (int i = 0; i < points.size(); i += 1) {
            out.print(points.get(i));
            if (i != points.size() - 1)
                out.print(" ");
        }
        out.println();
        out.close();
    }
    static void genSample() throws FileNotFoundException {
        out = new PrintWriter("../tests/01");       
        out.println("5 4\r\n3 0 5 1 2");
        out.close();
        out = new PrintWriter("../tests/02");       
        out.println("7 3\r\n8 8 9 13 1 5 10");
        out.close();
    }
    static int randFromTo(int l, int r) {
        return rnd.nextInt(r - l + 1) + l;      
    }
    static ArrayList<Integer> genPoints(int n, int maxD) {
        ArrayList<Integer> list = new ArrayList<Integer>();
        for (int i = 0; i < n; i++) {
            list.add(randFromTo(0, maxD));
        }
        return list;                
    }


    public static void main(String[] args) throws IOException {
        genSample();
        tNumber = 3;        
        for (int i = 0; i < 5; i++)
            printTest(genPoints(15, 50));
        for (int i = 0; i < 5; i++)
            printTest(genPoints(100, 500));
        for (int i = 0; i < 5; i++)
            printTest(genPoints(100, 1000000000));
        for (int i = 0; i < 5; i++)
            printTest(genPoints(1000, i * 100));
        for (int i = 0; i < 5; i++)
            printTest(genPoints(100000, 500));
        for (int i = 0; i < 10; i++)
            printTest(genPoints(100000, 1000000000));                   
    }
}
