#CCBCHBA0000110. Printing Pattern Using Loops

Printing Pattern Using Loops

Printing Pattern Using Loops

Source: HackerRank

Version: Phuoc Hung OJ Extended

Problem Statement

Given nn, print a (2n−1)(2n-1)-by-(2n−1)(2n-1) square. Each cell on the outer border contains nn; values decrease by one at each concentric layer until the central value is 1. Adjacent numbers are separated by one space, with no trailing spaces.

Input

One line contains integer nn.

Output

Print exactly 2n−12n-1 rows.

Subtasks

  • Subtask 1 (20%): 1≤n≤31\le n\le 3.

  • Subtask 2 (30%): 1≤n≤71\le n\le 7.

  • Subtask 3 (50%): 1≤n≤151\le n\le 15.

Examples

Example 1

Input:

2

Output:

2 2 2
2 1 2
2 2 2

Explanation:

The square has side length 3; outer cells contain 2 and the center contains 1.

Example 2

Input:

1

Output:

1

Explanation:

The square has side length 1; outer cells contain 1 and the center contains 1.