import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.Random;

/**
 * doall
 *
 * @author 24.11.2009
 */
public class doall {
    int testNo;

    void printTest(String p) throws FileNotFoundException {
        if (p.length() > 250000) {
            p = p.substring(0, 250000);
        }
        testNo++;
        String testName = "" + (testNo / 10) + (testNo % 10);
        PrintWriter out = new PrintWriter(testName);
        System.out.println("Generated " + testName);
        out.println(p);
        out.close();
    }

    Random rnd;

    void run() throws FileNotFoundException {
        printTest("abaabaababa");
        printTest("a");
        printTest("aa");
        printTest("ab");
        printTest("aaa");
        printTest("aab");
        printTest("aba");
        printTest("baa");
        printTest("bab");
        printTest("abb");
        printTest("bba");
        printTest("bbb");
        printTest("abab");
        printTest("abba");
        printTest("abbb");
        printTest("aabb");
        printTest("aaba");
        printTest("ababa");
        printTest("ababab");
        printTest("abaaba");
        printTest("ababaab");
        rnd = new Random(123131313);
        for (int i = 0; i < 3; i++) {
            printTest(generateRandom(100, i + 2));
        }
        for (int i = 15; i < 25; i++) {
            printTest(generateRandom(100, i + 2));
        }
        for (int i = 1; i <= 25; i += 3) {
            printTest(generateRegular(10, i * 1000, 2));
        }
        for (int i = 1; i <= 25; i += 3) {
            printTest(generateRegular(40, i * 250, 2));
        }
        for (int i = 5; i <= 50; i += 5) {
            printTest(generateRegular2(i * 1000, 250 / i, 2 + rnd.nextInt(2)));
        }
    }

    int cover(String s) {
        char[] c = s.toCharArray();
        int n = c.length;

        int[] b = new int[n];
        int[] q = new int[n];
        int[] r = new int[n];

        int k = 0;
        q[0] = 0;
        r[0] = 0;
        for (int i = 1; i < n; i++) {
            while (k > 0 && c[i] != c[k]) {
                k = b[k - 1];
            }
            if (c[i] == c[k]) {
                k++;
            }
            b[i] = k;

            if (k != 0 && r[q[k - 1]] + q[k - 1] + 1 >= i) {
                q[i] = q[k - 1];
                r[q[i]] = i;
            } else {
                q[i] = i;
                r[i] = i;
            }
        }
        return q[n - 1] + 1;
    }

    int lastCover(String s) {
        char[] c = s.toCharArray();
        int n = c.length;

        int[] b = new int[n];
        int[] q = new int[n];
        int[] r = new int[n];

        int k = 0;
        q[0] = 0;
        r[0] = 0;
        for (int i = 1; i < n; i++) {
            while (k > 0 && c[i] != c[k]) {
                k = b[k - 1];
            }
            if (c[i] == c[k]) {
                k++;
            }
            b[i] = k;

            if (k != 0 && r[q[k - 1]] + q[k - 1] + 1 >= i) {
                q[i] = q[k - 1];
                r[q[i]] = i;
            } else {
                q[i] = i;
                r[i] = i;
            }
        }
        int z = n - 2;
        while (q[z] != q[n - 1]) {
            z--;
        }
        return z + 1;
    }

    int border(String s) {
        char[] c = s.toCharArray();
        int n = c.length;

        int[] b = new int[n];
        int[] q = new int[n];
        int[] r = new int[n];

        int k = 0;
        q[0] = 0;
        r[0] = 0;
        for (int i = 1; i < n; i++) {
            while (k > 0 && c[i] != c[k]) {
                k = b[k - 1];
            }
            if (c[i] == c[k]) {
                k++;
            }
            b[i] = k;
        }
        return b[n - 1];
    }

    String generateRandom(int l, int c) {
        StringBuilder b = new StringBuilder();
        for (int i = 0; i < l; i++) {
            b.append((char) ('a' + rnd.nextInt(c)));
        }
        return b.toString();
    }

    String generateRegular(int p, int d, int c) {
        StringBuilder b;
        do {
             b = new StringBuilder();
            for (int i = 0; i < p; i++) {
                b.append((char) ('a' + rnd.nextInt(c)));
            }
        } while (cover(b.toString()) == p);

        int q = lastCover(b.toString());
        StringBuilder r = new StringBuilder();
        for (int j = 0; j < d; j++) {
            if (rnd.nextBoolean()) {
                r.append(b.toString());
            } else {
                r.append(b.substring(0, q));
            }
        }
        return /*b.toString() + "$" + b.substring(0, q) + "$" + */r.toString();
    }

    String generateRegular2(int p, int d, int c) {
        StringBuilder b;
        do {
             b = new StringBuilder();
            for (int i = 0; i < p; i++) {
                b.append((char) ('a' + rnd.nextInt(c)));
            }
        } while (border(b.toString()) < 3);

        int q = border(b.toString());
        StringBuilder r = new StringBuilder();
        for (int j = 0; j < d; j++) {
            if (rnd.nextBoolean() || j == 0) {
                r.append(b.toString());
            } else {
                r.append(b.substring(q));
            }
        }
        return /*b.toString() + "$" + b.substring(q) + "$" + */r.toString();
    }

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