Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register
Language:
Silver Matrix
Time Limit: 2000MSMemory Limit: 131072K
Total Submissions: 1270Accepted: 804Special Judge

Description

If a matrix satisfies the following conditions, we call it a silver matrix.

1. The dimensions of the matrix are n * n.
2. All its elements belong to the set S = {1, 2, 3, …, 2n - 1}.
3. For every integer i (1 <= i <= n), all elements in the i-th row and i-th column make the set {1, 2, 3, …, 2n - 1}.

For example, the following 4 * 4 matrix is a silver matrix:

It is proved that silver matrix with size 2K * 2K always exists. And it is your job to find a silver matrix with size 2K * 2K.

Input

The input contains only an integer K (1 <= K <= 9).

Output

You may output any matrix with size 2K * 2K. To output a 2K * 2K matrix, you should output 2K lines, and in each line output 2K integers.

Sample Input

2

Sample Output

1 2 5 6
3 1 7 5
4 6 1 2
7 4 3 1

Source

[Submit]   [Go Back]   [Status]   [Discuss]

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator