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

public class TestsGenerator {
	Random r = new Random(272389);

	String genRec() {
		char left = (char) ('A' + r.nextInt(26));
		String res = "";
		res += left;
		res += "->";
		res += left;
		int l = r.nextInt(30) + 1;
		
		for (int i = 0; i < l - 1; i++) {
			if (r.nextBoolean()) {
				res += (char) ('a' + r.nextInt(26));
			} else {
				res += (char) ('A' + r.nextInt(26));
			}
		}
		return res;			
	}

	String genNonRec() {
		char left = (char) ('A' + r.nextInt(26));
		String res = "";
		res += left;
		res += "->";
		int l = r.nextInt(30) + 1;
		
		for (int i = 0; i < l; i++) {
			if (r.nextBoolean()) {
				res += (char) ('a' + r.nextInt(26));
			} else {
				res += (char) ('A' + r.nextInt(26));
			}
		}
		return res;			
	}

	void genTests(int firstNum) throws IOException {
		for (int i = firstNum; i <= 40; i++) {
			String name = "" + i;
			if (i < 10) {
				name = "0" + name;
			}
			PrintWriter out = new PrintWriter(new File(name));
			int n = r.nextInt(1000) + 1;
			out.println(n);
			int type = r.nextInt(3);
			if (type == 0) {
				for (int j = 0; j < n; j++) {
					out.println(genRec());
				}
			} else if (type == 1) {
				for (int j = 0; j < n; j++) {
					out.println(genNonRec());
				}
			} else {
				for (int j = 0; j < n; j++) {
					if (r.nextBoolean()) {
						out.println(genNonRec());
					} else {
						out.println(genRec());
					}
				}
			}
			out.close();
		}
	}

	public static void main(String[] args) throws IOException {
		new TestsGenerator().genTests(3);
	}
}