import java.io.*;
import java.math.BigInteger;
import java.util.Random;

public class TestsGen {

    int testCount;

    void write(String s) throws IOException {
        PrintWriter pw = new PrintWriter(String.format("../tests/%02d", ++testCount));
        System.out.println(testCount);
        pw.println(s);
        pw.close();
    }
    
    void write(int n) throws IOException {
    	write(Integer.toString(n));
    }

    Random random = new Random(43534543);
    int MAXLEN = 10000;
    
    int[] prelim = new int[]{22, 200, 1000, 239};
    
    void genPreliminary() throws IOException {
    	for (int i = 0; i < prelim.length; i++) {
    		PrintWriter out = new PrintWriter(String.format("../preliminary/%02d", i + 1));
    		out.println(prelim[i]);
    		out.close();
    	}
    }
    
    void writeEq(int a, int l) throws IOException {
    	StringBuilder sb = new StringBuilder();
    	for (int i = 0; i < l; i++) {
    		sb.append(a);
    	}
    	write(sb.toString());
    }
    
    void writeRand(int len) throws IOException {
    	StringBuilder sb = new StringBuilder();
    	for (int i = 0; i < len; i++) {
    		sb.append(random.nextInt(10));
    	}
    	write(new BigInteger(sb.toString()).toString());
    }
    
    void writeZero(int len) throws IOException {
    	StringBuilder sb = new StringBuilder();
    	sb.append(1);
    	for (int i = 0; i < len - 1; i++) {
    		sb.append(random.nextInt(10));
    	}
    	write(new BigInteger(sb.toString()).toString());
    }
    
    void writeMin(int len) throws IOException {
    	StringBuilder sb = new StringBuilder();
    	for (int i = 0; i < len; i++) {
    		sb.append(2 * (1 - i % 2));
    	}
    	write(sb.toString());
    }

    void run() throws IOException {
		new File("../preliminary").mkdir();
		new File("../tests").mkdir();

		genPreliminary();
		
		write(9);
		write(56);
		write(123);
		write(558);
		write(999);
		
		write(2020);
		write(random.nextInt(1000000 - 1000) + 1000);
		write(random.nextInt(1000000 - 1000) + 1000);
		write(random.nextInt(1000000 - 1000) + 1000);
		write(999999);
		
		writeRand(15);
		writeZero(99);
		writeRand(101);
		writeRand(366);
		writeRand(1000);
		writeRand(5397);
		writeRand(10000);
		writeRand(random.nextInt(MAXLEN - 10) + 10);
		writeMin(MAXLEN);
		writeEq(9, MAXLEN);
    }

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

}
