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

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

	BufferedReader br;
	StringTokenizer in;
	PrintWriter out;

	public String nextToken() throws IOException {
		while (in == null || !in.hasMoreTokens()) {
			in = new StringTokenizer(br.readLine());
		}
		return in.nextToken();
	}

	public int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	public long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	int tNumber;

	Random rnd;

	void print(String s) throws IOException {
		System.err.println(tNumber);
		if (tNumber < 10) {
			out = new PrintWriter("../tests/0" + tNumber);
		} else {
				out = new PrintWriter("../tests/" + tNumber);
		}
		tNumber++;
		out.println(s);
		out.close();
	}

	void genSimple() throws IOException {
		PrintWriter out;
		out = new PrintWriter("../preliminary/01");
		out.println("ab?c");
		out.close();
		out = new PrintWriter("../preliminary/02");
		out.println("aa??b?c");
		out.close();
	}

	public void genQuestions(int n) throws IOException {
		char[] s = new char[n];
		for (int i = 0; i < n; i++) {
			s[i] = '?';
		}
		String st = new String(s);
		print(st);
	}

	public void genLetter(int n, int k) throws IOException {
		char[] s = new char[n];
		for (int i = 0; i < n; i++) s[i] = '?';
		for (int j = 0; j < k; j++) {
			int q = rnd.nextInt(n);
			s[q] = (char) ('a' + j);
		}
		String st = new String(s);
		print(st);
	}
	public void genRandom(int n, int alph) throws IOException {
		char[] s = new char[n];
		for (int i = 0; i < n; i++) {
			int q = rnd.nextInt(( alph + 2) *(alph + 1));
			if (q > alph) {
				s[i] = '?';
			} else {
				s[i] = ((char) ((int)('a')+ q));
			}
		}
		print(new String(s));
	}
	public void genBigRandom(int n, int alph) throws IOException {
		char[] s = new char[n];
		for (int i = 0; i < n; i++) {
			int q = rnd.nextInt(( alph + 2) *(alph + 1));
			if (q > alph || i < n / 2) {
				s[i] = '?';
			} else {
				s[i] = ((char) ((int)('a')+ q));
			}
		}
		print(new String(s));
	}


	



	public void generate() throws IOException {
		new File("../preliminary").mkdir();
		new File("../tests").mkdir();
		tNumber = 1;
		rnd = new Random(313131313);
		genSimple();
		genQuestions(300);
		print("a?");
		print("a");
		print("?");
		print("?a");
		print("?ab?");
		print("b?a");
		genLetter(300, 1);
		genLetter(300, 3);
		genLetter(300, 10);
		genRandom(300, 2);
		genRandom(300, 2);
		for (int i = 0; i < 8; i++) {
			int q = 270 + rnd.nextInt(31);
			int w = 10 + rnd.nextInt(16);
			genRandom(q, w);
		}
		

		genQuestions(5000);
		genLetter(5000, 1);
		genLetter(5000, 3);
		genLetter(5000, 10);
		genRandom(5000, 2);
		genRandom(5000, 2);

		
		for (int i = 0; i < 14; i++) {
			int q = 4970 + rnd.nextInt(31);
			int w = 15 + rnd.nextInt(11);
			genRandom(q, w);
		}
	        genQuestions(1000000);
		genLetter(1000000, 1);
		genLetter(1000000, 3);
		genLetter(1000000, 10);

		genLetter(1000000, 25);
		genLetter(1000000, 25);
		genLetter(1000000, 25);
		genLetter(1000000, 25);
		genLetter(1000000, 25);

		genBigRandom(1000000, 0);
		genBigRandom(1000000, 0);
		genBigRandom(1000000, 0);
		genBigRandom(1000000, 0);
		genBigRandom(1000000, 1);
		genBigRandom(1000000, 1);

		for (int i = 0; i < 5; i++) {
			int q = 999970 + rnd.nextInt(31);
			int w = 20 + rnd.nextInt(6);
			genBigRandom(q, w);
		}



	}

	public void run() throws IOException {
			generate();
	}
}