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

public class TestGen {

    public TestGen() {
        random = new Random(42);
    }

    private class Test {
        private int[] numbers;

        public Test(int[] numbers)
        {
            this.numbers = numbers;
        }

        public void print(PrintWriter out)
        {
            out.print(numbers[0]);
            for (int i = 1; i < numbers.length; ++i)
                out.print("-" + numbers[i]);
            out.println();
        }
    }

    private class TestPrinter {
        int countTest;

        public TestPrinter()
        {
            countTest = 0;
            initDirectory();
        }

        private void initDirectory()
        {
            File dir = new File("../tests");
            if (dir.exists())
            {
                String[] files = dir.list();
                if (files == null)
                    throw new RuntimeException("It is not a directory!");
                for (int i = 0; i < files.length; ++i)
                    new File("../tests/" + files[i]).delete();
            }
            else
                dir.mkdir();
        }

        public void print(Test test)
        {
            PrintWriter out = null;
            try
            {
                String fileName = String.format("%02d", ++countTest);
                System.out.println("Test " + fileName);
                out = new PrintWriter(new FileOutputStream(new File("../tests/" + fileName)));

                test.print(out);
            }
            catch(Exception e)
            {
                e.printStackTrace();
            } 
            finally {
                if (out != null)
                    out.close();
            }
        }
    }

    private Test genTestWithOnlyDigits(int length)
    {
        int[] digits = new int[length];
        for (int i = 0; i < length; ++i)
            digits[i] = random.nextInt(9) + 1;
        return new Test(digits);
    }

    private void run()
    {
        TestPrinter testPrinter = new TestPrinter();

        ArrayList <Test> tests = new ArrayList<Test>();
        tests.add(new Test(new int[]{3000, 101}));
        tests.add(new Test(new int[]{123456789}));
        tests.add(new Test(new int[]{111111111}));
        tests.add(new Test(new int[]{3000, 121}));
        tests.add(new Test(new int[]{30000, 3000}));
        tests.add(new Test(new int[]{987654321, 87654321, 600000, 73000000}));
        tests.add(new Test(new int[]{87654321, 9060, 6000}));
        tests.add(new Test(new int[]{87, 9060, 6005, 9060, 6004, 9060, 6003, 9060, 6002, 9060, 6001, 9060, 6700}));
        tests.add(new Test(new int[]{600000, 73000000}));
        tests.add(new Test(new int[]{60000000, 2000}));
        tests.add(new Test(new int[]{60030000, 2000}));
        tests.add(new Test(new int[]{1000000}));
        tests.add(new Test(new int[]{1001001}));
        tests.add(new Test(new int[]{451000000}));
        tests.add(new Test(new int[]{123456789, 987654321}));
        tests.add(new Test(new int[]{1}));
        tests.add(genTestWithOnlyDigits(10));
        tests.add(genTestWithOnlyDigits(50));
        tests.add(new Test(new int[]{304980100, 609022, 630001, 30000, 600, 83000000}));
        tests.add(new Test(new int[]{950, 3070340, 20, 4, 7, 940550100, 60000, 9000, 50, 2000, 2000, 8, 80}));
        tests.add(new Test(new int[]{10000, 554000000, 4000, 3}));
        tests.add(new Test(new int[]{60210, 5005010, 53000000, 300, 1, 90}));
        tests.add(new Test(new int[]{30, 3000, 20000, 206570, 8701400, 2, 60, 6}));
        tests.add(new Test(new int[]{33000000, 905, 800300, 90000000, 10, 41000, 109099}));
        tests.add(new Test(new int[]{6070, 3040, 8000}));
        tests.add(new Test(new int[]{1020, 3040, 5060, 7080, 9020, 2030, 4050, 6070, 8090, 1020, 3000}));
        tests.add(new Test(new int[]{10, 11, 12, 13, 14, 15, 16, 17, 18, 19}));
        tests.add(new Test(new int[]{8010, 4}));
        tests.add(new Test(new int[]{300, 15000}));
        tests.add(new Test(new int[]{300, 15}));
        tests.add(new Test(new int[]{800000000, 15019}));
        tests.add(new Test(new int[]{700000040, 5099}));
        tests.add(new Test(new int[]{19, 9}));
        tests.add(new Test(new int[]{10, 4}));
        tests.add(new Test(new int[]{116, 3}));
        tests.add(new Test(new int[]{110, 6000})); 

        for (int i = 0; i < tests.size(); ++i)
            testPrinter.print(tests.get(i));
    }

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

    private Random random;
}