#!/usr/bin/env python3
import random
import string

import sys

# Init seed with first argument
random.seed(int(sys.argv[1]))

l = int(sys.argv[2])
letters = string.ascii_lowercase
words = [""] * 5000

for i in range(5000 * l):
    c = letters[i % 26]
    while True:
        idx = random.randrange(0, 5000)
        if len(words[idx]) < l:
            words[idx] += c
            break

text = ""
while len(text) < 3e5:
    random.shuffle(words)
    all_words = "".join(words)
    text += all_words
text = text[: int(3e5)]
print(0, text)
print(*words, sep="\n")
