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

public class gentests implements Runnable {
	public static void main(String[] args) {
		if (args.length < 1) {
			throw new Error("Not enough parameters");
		}
		L = Integer.parseInt(args[0]);
		new Thread(new gentests()).start();
	}

	PrintWriter out;

	Random rand = new Random(6082573165L);

	static int L, I;

	void open() {
		try {
			out = new PrintWriter(((I < 10) ? "0" : "") + I);
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
	}

	void close() {
		out.close();
		I++;
	}

	int rand(int l, int r) {
		return l + rand.nextInt(r - l + 1);
	}

	String randString(int len) {
		StringBuilder ans = new StringBuilder();
		for (int i = 0; i < len; i++) {
			ans.append((char) ('a' + rand.nextInt(26)));
		}
		return ans.toString().trim();
	}

	int MAXLEN = 1024;

	String insSpace(String s, double sp) {
		String ans = s;
		int c = 0;
		while (ans.length() < MAXLEN && c < s.length() * sp) {
			int i = rand(1, ans.length() - 1);
			ans = ans.substring(0, i) + " " + ans.substring(i, ans.length());
		}
		return ans;
	}

	void genTest(int n, int ll, int lr, double sp, double ns) {
		open();
		out.println(n);
		String wr = randString(rand(ll, lr));
		ArrayList<String> ans = new ArrayList<String>();
		String prev = wr;
		for (int i = 0; i < n; i++) {
			ans.add(insSpace(prev, sp));
			if (rand.nextDouble() > ns) {
				prev = randString(rand(ll, lr));
			}
		}
		Collections.shuffle(ans);
		for (String s : ans) {
			out.println(s);
		}
		out.println(wr);
		close();
	}

	void genSp() {
		open();
		out.println(MAXN);
		for (int j = 0; j < MAXN; j++) {
			for (int i = 0; i < MAXLEN - 1; i++) {
				out.print(i % 2 == 0 ? "a" : " ");
			}
			out.println();
		}
		for (int i = 0; i < MAXLEN / 2; i++) {
			out.print("a");
		}
		out.println();
		close();
	}

	int MAXN = 1000;

	public void solve() throws IOException {
		I = L;

		genTest(5, 1, 10, 0, 0);
		genTest(5, 1, 10, 0, 0.5);
		genTest(5, 1, 10, 0, 1);
		genTest(5, 1, 10, 0.5, 0.5);
		genTest(5, 1, 10, 1, 0.5);
		genSp();
		genTest(MAXN, 1, MAXLEN, 0.01, 0.5);
		genTest(MAXN, MAXLEN, MAXLEN, 0, 0);
		genTest(MAXN, MAXLEN, MAXLEN, 1, 1);
		genTest(MAXN, MAXLEN, MAXLEN, 0.346, 1);

		for (int i = 0; i < 5; i++) {
			int n = rand(1, MAXN);
			genTest(n, MAXLEN, MAXLEN, rand.nextDouble(), 1 - 1.0 / rand(1, n));
		}

		for (int i = 0; i < 5; i++) {
			int n = rand(1, MAXN);
			genTest(n, MAXLEN / 2, MAXLEN, rand.nextDouble(), 1 - 1.0 / rand(1,
					n));
		}

		for (int i = 0; i < 10; i++) {
			int l = rand(1, MAXLEN);
			int r = rand(l, MAXLEN);
			int n = rand(1, MAXN);
			genTest(n, l, r, rand.nextDouble(), 1 - 1.0 / rand(1, n));
		}
	}

	public void run() {
		try {
			solve();
		} catch (IOException e) {

		}

	}

}
