k-numbers#4834

k-numbers

1 second
64 megabytes
Very easy

For the given natural numbers and (2 \le k \le 10), your task is to generate and print all sequences of length using the characters 0, \ldots, k-1, in lexicographical order.

Input

The input consists of two numbers: and .

Output

Print each sequence on a separate line. Ensure that each sequence ends with a newline character, and the numbers within each sequence are separated by a single space.

Examples

Example 1

Loading
Loading