Codeforces Round 678 (Div. 2)
B
Prime Square
Codeforces
900
原题
← AC →
翻译中…

Sasha likes investigating different math objects, for example, magic squares. But Sasha understands that magic squares have already been studied by hundreds of people, so he sees no sense of studying them further. Instead, he invented his own type of square — a prime square.

翻译中…

A square of size $n \times n$ is called prime if the following three conditions are held simultaneously:

翻译中…
  • all numbers on the square are non-negative integers not exceeding $10^5$;
  • there are no prime numbers in the square;
  • sums of integers in each row and each column are prime numbers.
翻译中…

Sasha has an integer $n$. He asks you to find any prime square of size $n \times n$. Sasha is absolutely sure such squares exist, so just help him!

翻译中…

Input

翻译中…

The first line contains a single integer $t$ ($1 \le t \le 10$) — the number of test cases.

翻译中…

Each of the next $t$ lines contains a single integer $n$ ($2 \le n \le 100$) — the required size of a square.

翻译中…

Output

翻译中…

For each test case print $n$ lines, each containing $n$ integers — the prime square you built. If there are multiple answers, print any.

翻译中…

样例

Input #1
2
4
2
Output #1
4 6 8 1
4 9 9 9
4 10 10 65
1 4 4 4
1 1
1 1
InputCopy OutputCopy
题目信息
题号
1436B
时间限制
1.5 s
内存限制
256 MB
标签
构造
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。