cho.sh
Notes
Loading...

Star Printing - 10

Time limit

1s

Memory limit

256 MB

Problem

Print a recursively defined star pattern. N is a power of 3, and the pattern of size N is an N x N square.

The base pattern of size 3 has a blank center cell and one star in every other cell.

**** ****

When N is greater than 3, place eight patterns of size N/3 in a 3 x 3 grid and leave only the center (N/3) x (N/3) area blank.

Input

The first line contains an integer N. There is an integer k such that N = 3^k and 1 <= k < 8.

Output

Print the star pattern of size N from the first line through the N-th line.

**** ****