I can't remember the password!
Limits: 2 sec., 256 MiB
This statement was translated automatically from Ukrainian.
After a long ride, Zenyk and Marichka returned to Mrs. Tarnavska’s rented cottage. Zenyk wanted to show off to Marichka how he pushed \(O(nq)\) into a "Range Queries" problem yesterday.
He wanted to log into Algotest from his phone, but after scratching the back of his head, he realized he had forgotten his password. Fortunately, our website allows you to recover it. But Zenyk doesn’t want to use such help. What if Marichka finds out that he has a bad memory? She will make fun of him for the rest of his life. That shall not be!
Zenyk wants to guess his password. He clearly remembers that the
password consisted of \(m\) lowercase
Latin letters a-z, and only characters from
the first \(k\) letters of the alphabet
were used.
Today Zenyk will make \(n\) attempts. Obviously, it makes no sense to enter the same password more than once, so each attempt must be unique. If none of the \(n\) passwords work, he will stop guessing and strain his memory in the hope that he manages to remember.
Help Zenyk make a list of attempts — print \(n\) different strings consisting of \(m\) lowercase letters and using only characters from the first \(k\) letters of the alphabet.
Input
The input contains three integers \(n\), \(m\), \(k\) — the number of attempts, the length of the password, and the letter constraint.
Output
Print \(n\) different strings, each consisting of \(m\) lowercase letters and using only characters from the first \(k\) letters of the alphabet.
Constraints
\(1 \le m \le 20\),
\(1 \le k \le 26\),
\(1 \le n \le \min\{10^4, k^m\}\).
Samples
| Input (stdin) | Output (stdout) |
|---|---|
| 4 7 25 | pasword maricka qwertyu oblasna |
Notes
It can be shown that under such constraints, the answer always exists.
Submit a solution
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|