#include "testlib.h"
#include "get-options.h"
#include <bits/stdc++.h>

int main(int argc, char *argv[]) {
  registerGen(argc, argv, 1);

  int n = getOption(argc, argv, "N");
  int E = getOption(argc, argv, "E", 26);
  int mn = getOption(argc, argv, "MN", 1);
  int mx = getOption(argc, argv, "MX", 10);
  bool eq = getOption(argc, argv, "EQ", 0);
  bool uniq = getOption(argc, argv, "UNIQ", 0);
  mx = std::min(mx, E);
  mn = std::min(mn, mx);
  assert(1 <= mn && mn <= mx && mx <= 10);
  std::string base(E, ' ');
  for (int i = 0; i < E; i++) {
    base[i] = char('a' + i);
  }

  std::cout << n << " " << E << "\n";
  shuffle(base.begin(), base.end());
  std::vector<std::string> res;

  for (int i = 0; i < (n + E - 1) / E * E; i++) {
    int len = rnd.next(mn, mx);
    std::string cur;
    if (eq) {
      cur.push_back(char('a' + i % E));
    }
    while (static_cast<int>(cur.length()) < len) {
      auto ch = static_cast<char>('a' + rnd.next(0, E - 1));
      if (uniq && std::ranges::count(cur, ch))
        continue;
      cur.push_back(ch);
    }
    res.push_back(cur);
  }
  shuffle(res.begin(), res.end());
  res.resize(n);
  for (const auto& key : res) {
    std::cout << key << "\n";
  }
}
