#ARC140E. [ARC140E] Not Equal Rectangle

[ARC140E] Not Equal Rectangle

Score : 800800 points

Problem Statement

We have a grid with N×MN \times M squares. You will fill every square with an integer between 11 and 2525 (inclusive). Let ai,ja_{i,j} be the integer to be written in the square at the ii-th row from the top and jj-th column from the left.

Find a way to fill the squares to satisfy the condition below. It can be proved that, under the Constraints of this problem, such a way always exists.

  • For any integers 1x1<x2N,1y1<y2M1\leq x_1 < x_2\leq N,1\leq y_1 < y_2 \leq M, it must not be the case that ax1,y1,ax1,y2,ax2,y1,ax2,y2a_{x_1,y_1},a_{x_1,y_2},a_{x_2,y_1},a_{x_2,y_2} are all equal.

Constraints

  • 2N,M5002 \leq N , M \leq 500
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN MM

Output

Print one way to fill the squares to satisfy the condition, in the format below:

a1,1a_{1,1} a1,2a_{1,2} \ldots a1,Ma_{1,M}

a2,1a_{2,1} a2,2a_{2,2} \ldots a2,Ma_{2,M}

\vdots

aN,1a_{N,1} aN,2a_{N,2} \ldots aN,Ma_{N,M}

If there are multiple solutions, printing any of them will be accepted.

2 3
1 1 1
1 2 3

(x1,x2,y1,y2)(x_1,x_2,y_1,y_2) can be one of (1,2,1,2),(1,2,2,3),(1,2,1,3)(1,2,1,2),(1,2,2,3),(1,2,1,3).

For any of them, the numbers written in the squares are not all equal, so this output satisfies the condition.