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

public class TestsGen {
	static int testcount = 0;

	static Random random = new Random(934752);
	
	static String[] names = new String[]{"A", "B", "C", "D", "A1", "B1", "C1", "D1"};

	static void write(int a, int b, int c, int d) throws IOException {
		PrintWriter out = new PrintWriter(String.format("%02d", ++testcount));
		System.out.println("Generating test #" + testcount);
		out.println(names[a - 1] + names[b - 1]);
		out.println(names[c - 1] + names[d - 1]);
		out.close();
	}

	static void write(int a) throws IOException {
		PrintWriter out = new PrintWriter(String.format("%02d", ++testcount));
		System.out.println("Generating test #" + testcount);
		a--;
		int b = random.nextInt(8);
		int c = random.nextInt(8);
		while (b == a || c == a || b == c) {
			b = random.nextInt(8);
			c = random.nextInt(8);
		}
		out.println(names[a] + names[b]);
		if (random.nextBoolean()) {
			out.println(names[a] + names[c]);
		} else {
			out.println(names[c] + names[a]);
		}
		out.close();
	}

	static void writeRand() throws IOException {
		PrintWriter out = new PrintWriter(String.format("%02d", ++testcount));
		System.out.println("Generating test #" + testcount);
		int i = 0;
		int j = 0;
		int k = 0;
		int l = 0;
		do {
			i = random.nextInt(8);
			j = random.nextInt(8);
			k = random.nextInt(8);
			l = random.nextInt(8);
			while (j == i) {
				j = random.nextInt(8);
			}
			while (l == k) {
				l = random.nextInt(8);
			}
		} while ((i == k && j == l) || (i == l && j == k));
		out.println(names[i] + names[j]);
		out.println(names[k] + names[l]);
		out.close();
	}

	public static void main(String[] args) throws IOException {
		while (new File(String.format("%02d.t", testcount + 1)).exists()) {
			testcount++;
		}
		for (int i = 0; i < 30; i++) {
			writeRand();
		}
		write(1, 8, 4, 5);
		write(4, 7, 8, 3);
		write(6, 3, 2, 7);
		write(1, 6, 5, 2);
		write(1, 3, 2, 4);
		write(5, 7, 6, 8);
		write(6, 4, 5, 3);
		write(4, 6, 7, 1);
		write(6, 4, 8, 2);
		write(7, 1, 5, 3);
		write(7, 1, 2, 8);
		write(5, 3, 8, 2);
		for (int i = 0; i < 8; i++) {
			write(i + 1);
		}
	}

}
