import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.*;

public class Tests_streaming {
    Random rnd = new Random(239);

    int MAX_N = 1_000_000;
    int MAX_C = 1_000_000_000;
    int MAX_D = 1_000;

    int tests = 1;

    public void writeTest(int C, int[] a, boolean shuffle) {
        try {
            PrintWriter out = tests == -1 ? new PrintWriter(System.out) : new PrintWriter(String.format("%02d", tests++));

            ArrayList<Integer> set = new ArrayList<>();
            Arrays.stream(a).forEach(set::add);
            if (shuffle) {
                Collections.shuffle(set, rnd);
            }

            out.println(a.length + " " + C);

            for (int i = 0; i < a.length; i++) {
                if (i != 0) {
                    out.print(" ");
                }
                out.print(set.get(i));
            }
            out.println();

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

    public void writeTest(int C, int[] a) {
        writeTest(C, a, true);
    }

    public void sample1() {
        writeTest(7, new int[]{1, 1, 1, 1, 1, 1, 1});
    }

    public void sample2() {
        writeTest(3, new int[]{3, 1, 1});
    }

    public void random(int size, int C, int D) {
        int[] a = new int[size];
        C = rnd.nextInt(C) + 1;
        for (int i = 0; i < a.length; i++) {
            a[i] = rnd.nextInt(D) + 1;
        }
        writeTest(C, a);
    }

    public void max() {
        int[] a = new int[MAX_N];
        Arrays.fill(a, 1);
        writeTest(MAX_C, a);
    }

    public void max2() {
        int[] a = new int[MAX_N];
        Arrays.fill(a, 1);
        int MAX_C = 1_000_000;
        for (int i = 0; i < MAX_C / MAX_D; i++) {
            a[i] = MAX_D;
        }
        writeTest(MAX_C, a);
    }

    public void max3() {
        int[] a = new int[MAX_N];
        Arrays.fill(a, 1);
        writeTest(1, a);
    }

    public void gen(String[] args, int test) {
        tests = test;
        switch (args[0]) {
            case "sample1":
                sample1();
                break;
            case "sample2":
                sample2();
                break;
            case "max":
                max();
                break;
            case "max2":
                max2();
                break;
            case "max3":
                max3();
                break;
            case "random":
                int size = Integer.parseInt(args[1]);
                int C = Integer.parseInt(args[2]);
                int D = Integer.parseInt(args[3]);
                int seed = Integer.parseInt(args[4]);
                rnd = new Random(seed);
                random(size, C, D);
                break;
        }
    }

    public void gen() {
        try {
            Scanner in = new Scanner(new File("tests_streaming.txt"));
            int test = 1;
            while (in.hasNext()) {
                String line = in.nextLine();
                if (line.length() == 0)
                    break;
                String[] x = line.split(" ");
                gen(Arrays.copyOfRange(x, 1, x.length), test++);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        if (args.length > 0) {
            new Tests_streaming().gen(args, -1);
        } else {
            new Tests_streaming().gen();
        }
    }
}
