import java.util.*;
public class generator {
private final int MIN_W = 6;
private final int MAX_W = 12;
private final int MIN_H = 13;
private final int MAX_H = 19;
private final int MAX_K = 10000;
private int w;
private int h;
private String[] c;
private Random random;
private int randomIntBetween(int lower, int upper) {
return lower + random.nextInt(upper - lower + 1);
}
private String randomColumn(int pos, int len, int start) {
if (randomIntBetween(0, 7 + pos) == 4) return "***";
char res[] = new char[3];
for (int i = 0; i < 3; ++i)
res[i] = (char)('a' + randomIntBetween(0, start - 1 + 11*pos*pos/len/len));
return new String(res);
}
private void generate(long seed) {
if (seed == 1) { // sample case
w = 6;
h = 13;
c = new String[] {
"aba",
"bba",
"bbb",
"aab",
"bac",
"cac",
"***",
"ccb",
"cda",
"aad",
"dbc"
};
return;
}
random = new Random(seed);
w = randomIntBetween(MIN_W, MAX_W);
h = randomIntBetween(MIN_H, MAX_H);
int k = randomIntBetween(11*w*h, Math.min(47*w*h, MAX_K));
int start = 4;
if (w - MIN_W <= 1)
--start;
if (MAX_W - w <= 1)
++start;
c = new String[k];
for (int i = 0; i < k; ++i)
c[i] = randomColumn(i, k, start);
}
private void print() {
System.out.println("" + w + " " + h);
System.out.println("" + c.length);
for (int i = 0; i < c.length; i++)
System.out.println(c[i]);
}
public static void main(String args[]) {
long seed = 1L;
if (args.length == 1)
seed = Long.parseLong(args[0]);
generator g = new generator();
g.generate(seed);
g.print();
}
}