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

public class TestsGen implements Runnable {
    public static void main(String[] args) {
        new Thread(new TestsGen()).start();
    }

    public int done = 1;
    ArrayList<String> data;

    public final int testCount = 25; // 50

    public final int maxLen = (int) 1e6;
    public final int maxVal = (int) 1e4;

    public final int minLen = 1;
    public final int minVal = 1;

    public final int smallLen = 5000;
    public final int smallVal = 5000;

    public final int smallCount = 30; // use with testCount = 50

    public final int tinyLen = 500;

    public void print() throws IOException {
        done++;
        System.err.println(done);
        PrintWriter out;
        if (done < 10)
            out = new PrintWriter("0" + String.valueOf(done));
        else
            out = new PrintWriter(String.valueOf(done));

        for (int i = 0; i < data.size(); i++)
            out.println(data.get(i));
        data.clear();
        out.println();
        out.close();
    }

    public void gen(int lowN, int highN, int lowVal, int highVal)
            throws IOException {
        done++;
        System.err.println(done);
        PrintWriter out;
        if (done < 10)
            out = new PrintWriter("0" + String.valueOf(done));
        else
            out = new PrintWriter(String.valueOf(done));

        int n = nextInt(lowN, highN);
        out.println(n);
        for (int i = 0; i < n; i++) {
            if (i > 0) {
                out.print(" ");
            }

            int val = nextInt(lowVal, highVal);
            if (nextInt(0, 1) == 0) {
                val += -highVal - lowVal;
            }
            if (lowVal == highVal) {
                val = lowVal;
            }
            out.print(val);
        }

        out.println();
        out.close();

    }

    public int nextInt(int low, int high) {
        if (high <= low) {
            return low;
        }
        int base = high - low + 1;
        int val = rnd.nextInt();
        val %= base;
        while (val < 0)
            val += base;
        val += low;
        return val;
    }

    public void genLadder(int len, int lowVal, int highVal, int step,
            boolean increasing) throws IOException {

        if ((highVal - lowVal) / len * 2 != 0
                && (highVal - lowVal) / len * 2 < step) {
            step = (highVal - lowVal) / len * 2;
        }
        done++;
        System.err.println(done);
        PrintWriter out;
        if (done < 10)
            out = new PrintWriter("0" + String.valueOf(done));
        else
            out = new PrintWriter(String.valueOf(done));

        out.println(len);
        int val = lowVal;
        if (!increasing) {
            val = highVal;
        }
        for (int i = 0; i < len; i++) {
            if (i > 0) {
                out.print(" ");
            }
            if (increasing) {
                val = nextInt(Math.min(val + 1, highVal),
                        Math.min(val + step, highVal));
            } else {
                val = nextInt(Math.max(lowVal, val - step),
                        Math.max(lowVal, val - 1));
            }
            out.print(val);
            if (val == lowVal && !increasing) {
                increasing = !increasing;
            }
            if (val == highVal && increasing) {
                increasing = !increasing;
            }
        }

        out.println();
        out.close();

    }

    public void genBordTests() throws IOException {
        gen(maxLen, maxLen, maxVal, maxVal);
        gen(minLen, minLen, maxVal, maxVal);
        gen(minLen, minLen, minVal, minVal);

    }

    public void genLadders() throws IOException {
        genLadder(tinyLen, minVal, 40, 1, true);
        genLadder(smallLen, minVal, smallVal, 10, true);
        genLadder(maxLen, minVal, maxVal, 1000, true);
        genLadder(tinyLen, minVal, 40, 1, false);
        genLadder(smallLen, minVal, smallVal, 10, false);
    }

    public void genRandom() throws IOException {
        for (int i = 0; i < 2; i++) {
            gen(minLen, tinyLen, minVal, smallVal);
        }
        for (int i = 0; i < 2; i++) {
            gen(tinyLen * 2, smallLen, minVal, smallVal);
        }
        for (int i = 0; i < 2; i++) {
            gen(tinyLen * 2, smallLen, smallVal, maxVal);
        }

        for (; done < testCount;) {
            gen(smallLen, maxLen, smallVal, maxVal);
            if (done < testCount) {
                gen(smallLen, maxLen, minVal, smallVal);
            }

        }
    }

    public void genLeft(int len, int val) throws IOException {
        done++;
        System.err.println(done);
        PrintWriter out;
        if (done < 10)
            out = new PrintWriter("0" + String.valueOf(done));
        else
            out = new PrintWriter(String.valueOf(done));

        out.println(len);
        out.print(-val);
        for (int i = 1; i < len; i++) {
            out.print(" ");
            out.print(1);
        }
        out.println();
        out.close();
    }

    public void genRight(int len, int val) throws IOException {
        done++;
        System.err.println(done);
        PrintWriter out;
        if (done < 10)
            out = new PrintWriter("0" + String.valueOf(done));
        else
            out = new PrintWriter(String.valueOf(done));

        out.println(len);

        for (int i = 1; i < len; i++) {
            out.print(1);
            out.print(" ");
        }
        out.print(-val);
        out.println();
        out.close();
    }

    Random rnd;

    public void run() {
        try {
            rnd = new Random(346);

            data = new ArrayList<String>();

            genBordTests();
            genLadders();

            genLeft(tinyLen, smallVal);
            genRight(tinyLen, smallVal);

            genLeft(smallLen, smallVal);
            genRight(smallLen, smallVal);

            genLeft(maxLen, maxVal);
            genRight(maxLen, maxVal);

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