QOJ.ac

QOJ

時間限制: 1 s 記憶體限制: 1024 MB 總分: 100 可 Hack ✓

#18491. Prize Draw

统计

Cheonghan, who was sad that UCPC is held online this year as well as last year, searched through parallel universes and found a world where everyone gathers in one place to hold the contest as usual. Cheonghan decided to hold a grand prize draw event at the award ceremony of this world.

On the stage where the event takes place, there are $K$ boxes, and each box contains $N$ balls, each with a number written on it. The host first chooses two of these boxes and places them on the table. Then, the host draws one ball from each of the two boxes, and the sum of the numbers written on the two balls is called the winning number.

Cheonghan wants the winning numbers to be as diverse as possible when drawing, so that more participants have a chance to win. Therefore, no matter which two boxes the host chooses, for all $N^2$ ways of drawing two balls (one from each of the two chosen boxes), the sums of the numbers written on the two balls must all be distinct. Let's help Cheonghan configure the boxes so that this condition is satisfied.

Input

In the first line, the integer $K$ ($2 \le K \le 30$) representing the number of boxes and the integer $N$ ($2 \le N \le 2\,000$) representing the number of balls in each box are given, separated by a space.

Output

Over $K$ lines, output $N$ integers to be written on the balls in each box, separated by spaces.

However, only integers between $1$ and $5\,000\,000$ (inclusive) can be written on the balls, and it is guaranteed that a configuration satisfying the conditions exists for all possible inputs.

Examples

Input 1

3 4

Output 1

20 5 17 1
18 11 16 5
13 3 12 21

Note

No matter which two of the three boxes the host chooses, $4^2 = 16$ distinct winning numbers are created. For example, if the first box and the second box are chosen, the winning numbers created are as shown below.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.