Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/matritsa-kvadrat-qatlamlar

Square layers

Easy 1000 ms 64 MB 22%
Share

Fill an $n \times n$ square table with frames: the cells of the outermost frame get $1$, the frame inside it gets $2$, and so on (each cell holds the number of its frame, that is, the distance to the nearest edge plus one). Print the table.

A 5 by 5 table: outer frame 1, the inner one 2, the center 3

Input

One positive integer $n$.

Output

$n$ lines with $n$ numbers each.

Note

$1 \le n \le 100$

Examples

Input #1
5
Output #1
1 1 1 1 1
1 2 2 2 1
1 2 3 2 1
1 2 2 2 1
1 1 1 1 1
Input #2
1
Output #2
1

Sign in to submit a solution

Signing up is free and takes a minute.