import java.io.*;
import java.util.Arrays;
import java.util.Random;

public class doall_army {


    class Test {
        int n;
        int[] las;
        String comment;

        Test(String comment, int n, int... las) {
            this.n = n;
            this.las = las;
            Arrays.sort(las);
            for (int i = 0; i < las.length; i++) {
                for (int j = i + 1; j < las.length; j++) {
                    if (las[i] == las[j]) {
                        throw new AssertionError("Numbers must be different");
                    }
                }
            }
            this.comment = comment;
        }


        @Override
        public String toString() {
            return "Test{" +
                    "n=" + n +
                    ", las=" + las +
                    ", comment='" + comment + '\'' +
                    '}';
        }
    }


    int fileNumber = 1;

    void write(Test test) {
        write(new File(String.format("%02d", fileNumber++)), test);
        String xmlComment = "<test points = \"0\" comment = \"" + test.comment + ", n = " + test.n + ", k = " + test.las.length + "\" / >";
        comments.println(xmlComment);
    }

    void beginGroup(String name, int points) {
        String header = "<test-group\n" +
                "   comment = \"" + name + "\"\n" +
                "   score = \"group\"\n" +
                "   feedback = \"outcome\"\n" +
                "   group-bonus = \"" + points + "\"\n" +
                ">";
        comments.println(header);
    }

    void endGroup() {
        comments.println(" </test-group>");
    }


    static void write(File file, Test test) {
        try {
            PrintWriter printWriter = new PrintWriter(file);
            printWriter.println(test.n);
            printWriter.println(test.las.length);
            for (int i = 0; i < test.las.length; i++) {
                printWriter.print(test.las[i] + 1);
                if (i != test.las.length - 1) {
                    printWriter.print(" ");
                }
            }
            printWriter.println();
            printWriter.close();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    PrintWriter comments;
    Random random = new Random(1);

    Test randTest(int n, int k) {
        boolean[] used = new boolean[n];
        for (int i = 0; i < k; i++) {
            int now = -1;
            while (used[now = random.nextInt(n)]) ;
            used[now] = true;
        }
        int it = 0;
        int[] las = new int[k];
        for (int i = 0; i < n; i++) {
            if (used[i]) {
                las[it++] = i;
            }
        }
        return new Test("Случайный тест", n, las);
    }

    int[] MAX_LENGTH = {0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4};


    Test maxTest(int n) {
        int[] las = new int[MAX_LENGTH[n]];
        for (int i = 0; i < las.length; i++) {
            las[i] = i;
        }
        return new Test("Максимальный тест", n, las);
    }

    Test allTest(int n) {
        int[] las = new int[n];
        for (int i = 0; i < las.length; i++) {
            las[i] = i;
        }
        return new Test("Тест, в котором задана вся перестановка", n, las);
    }

    Test oneTest(int n) {
        int[] las = new int[1];
        for (int i = 0; i < las.length; i++) {
            las[i] = random.nextInt(n);
        }
        return new Test("Тест, в котором задано одно число", n, las);
    }

    Test segmentTest(int n, int from, int to) {
        int[] las = new int[to - from + 1];
        for (int i = 0; i < las.length; i++) {
            las[i] = from + i;
        }
        return new Test("Тест с отрезком", n, las);
    }

    public void run() throws IOException {
        comments = new PrintWriter(new OutputStreamWriter(new FileOutputStream("tests.lst"), "UTF-8"));
        beginGroup("Подзадача 1. n <= 8", 30);
        write(new Test("Ручной тест", 1, 0));
        write(new Test("Ручной тест", 2, 0));
        write(new Test("Ручной тест", 3, 0));
        write(new Test("Ручной тест", 3, 1));
        write(new Test("Ручной тест", 3, 2));
        write(new Test("Ручной тест", 3, 0, 1));
        write(new Test("Ручной тест", 3, 1, 2));
        write(new Test("Ручной тест", 3, 0, 1, 2));
        write(randTest(8, 3));
        write(randTest(8, 2));
        write(randTest(8, 3));
        write(randTest(8, 4));
        write(randTest(8, 5));
        write(randTest(8, 6));
        write(randTest(8, 7));
        write(maxTest(8));
        write(allTest(8));
        write(oneTest(8));
        endGroup();
        for (int i = 10; i <= 15; i++) {
            if (i == 10) {
            	beginGroup("Подзадача " + (i - 8) + ". 9 <= n <= 10" , 10);
            } else {
            	beginGroup("Подзадача " + (i - 8) + ". n = " + i, 10);
            }
            write(maxTest(i));
            if (i == 14 || i == 15) {
                write(segmentTest(i, i - 4, i - 1));
            }
            if (i % 2 == 0) {
                write(allTest(i));
            } else {
                write(oneTest(i));
            }
            write(randTest(i, 3));
            write(randTest(i, 4));
            write(randTest(i, 5));
            if (i > 13) {
                write(randTest(i, 7));
            }
            write(randTest(i, i - 2 - random.nextInt(2)));
            endGroup();
        }


        comments.close();
    }

    public static void main(String[] args) throws IOException {
        new doall_army().run();
    }

}
