PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#SP0000144. Ma trận vuông tổng nguyên tố (Prime Square)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Ma trận vuông tổng nguyên tố (Prime Square)

Prime Square

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

Given an integer nn, construct an n×nn\times n square satisfying all conditions:

  • Every entry is a nonnegative integer at most 10510^5.
  • No entry is prime.
  • The sum of the entries in each row and each column is prime.

Print any valid square.

Input

One line contains integer nn.

Output

Print exactly nn lines of nn integers describing a valid square.

Subtasks

  • Subtask 1 (20 points): 2≤n≤302\le n\le30; 0≤aij≤1050\le a_{ij}\le10^5 for every 1≤i,j≤n1\le i,j\le n.
  • Subtask 2 (30 points): 2≤n≤552\le n\le55; 0≤aij≤1050\le a_{ij}\le10^5 for every 1≤i,j≤n1\le i,j\le n.
  • Subtask 3 (50 points): 2≤n≤1002\le n\le100; 0≤aij≤1050\le a_{ij}\le10^5 for every 1≤i,j≤n1\le i,j\le n.

Examples

Input

4

Output

0 1 1 1
1 0 1 1
1 1 0 1
1 1 1 0

Explanation

For n=4n=4, all entries are 00 or 11, neither of which is prime. Each row contains three ones and one zero, so its sum equals prime 33. Each column has the same sum 33. The matrix is valid.