P25843 [AtCoder] Monotonically Increasing
入门
题目描述

Problem Statement

Print all strictly increasing integer sequences of length N where all elements are between 1 and M (inclusive), in lexicographically ascending order.

Input

Input is given from Standard Input in the following format:
N M

Output

Print the sought sequences in lexicographically ascending order, each in its own line (see Sample Outputs).

Constraints

  • $1 \le N \le M \le 10$
  • All values in input are integers.

Sample Input 1

2 3

Sample Output 1

1 2
1 3
2 3

The sought sequences are (1,2),(1,3),(2,3), which should be printed in lexicographically ascending order.

Sample Input 2

3 5

Sample Output 2

1 2 3
1 2 4
1 2 5
1 3 4
1 3 5
1 4 5
2 3 4
2 3 5
2 4 5
3 4 5

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
2 3
样例输出
1 2 1 3 2 3