12885 - Pekotrick and Spongebob run away   

Description

After finishing dinner in SAO, it's time to have the bill. But Spongebob only has bubble-money and Patrick only has rock-money.

Of course they can't pay in neither bubble-money nor in rock-money. So the cashier is so mad that he calls the police to catch them. Spongebob and Patrick feel scared and they run away immediately(please don’t imitate them). To prevent from being caught, Patrick decide to cosplay an usagi.

Assuredly Patrick needs to move like an usagi, too. Formally we call "moving like an usagi" is that the footprint he left will look like a rabbit jump↘jump↗jump↘jump↗. And you have to help Patrick to move like an usagi.

To simplify the problem, we consider Patrick is on a m grid where m is an even number. And he is at the upper-left cell (1,1) in the begining. When he starts to move, he will go down continuously until the next cell he will move to is out of bounds. Then he will move to the right cell and go up with the previous pattern(stops when the next cell is out of bounds). While the right cell isn't out of bounds, he will move to the right cell and then keep moving like how he has moved(i.e. keep going down, move to the right cell, keep going up, move the right cell, keep going down......) until he can't move anymore.

What you have to do is to offer a map. And there must be a m grid on the map and all the cells in the grid are noted the order Patrick should visit. In this way Patrick can move like an usagi by following your map(don’t worry about Patrick’s counting ability).

The following image shows the example of  n = 5, m = 6

 

Subtask

- for testcase 1~2: n = 1

- for testcase 3~5: n = 2

- for testcase 6~10: no additional restriction

Input

The first line contains two integers n(1 ≤ nm ≤ 500) – the size of the grid which Patrick moves on.

It is guaranteed that m must be an even number.

Output

Output a m grid which is the map Patrick will follow.

Please reference the format of sample output and do not output space at the end of any line.

Remember to print a newline('\n') at the end of the last line.

Sample Input  Download

Sample Output  Download

Tags




Discuss