Grid with equal xor#9559

Grid with equal xor

1 second
128 megabytes
Easy

Given an integer which is a multiple of . Find an n \times n grid for which the bitwise xor of every row and every column is the same. Each number from to n^2 - 1 must appear in the grid exactly once.

Input

One integer (1 \le n \le 4000), which is a multiple of .

Output

Print an n \times n grid with numbers from to n^2 - 1 for which the bitwise xor of every row and column is the same. If there are multiple solutions, print any.

Examples

Example 1

Loading
Loading