atcoder#AGC056A. [AGC056A] Three Cells per Row and Column

[AGC056A] Three Cells per Row and Column

Score : 300300 points

Problem Statement

We have a grid board with NN rows and NN columns.

Paint every square black or white to satisfy all of the conditions below.

  • For each row, exactly three of the squares in that row are painted black.
  • For each column, exactly three of the squares in that column are painted black.
  • There are exactly NN connected components of black squares. Here, two black squares xx and yy are considered connected when it is possible to start at xx and reach yy by repeatedly moving up, down, left, or right to a black square.

It can be proved that the Constraints of the problem guarantee the existence of a solution.

Constraints

  • 6N5006 \leq N \leq 500
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN

Output

Print your answer in the following format:

s1,1s1,2s1,Ns_{1,1}s_{1,2}\cdots s_{1,N}

s2,1s2,2s2,Ns_{2,1}s_{2,2}\cdots s_{2,N}

\vdots

sN,1sN,2sN,Ns_{N,1}s_{N,2}\cdots s_{N,N}

Here, si,js_{i,j} should be a character representing the color of the square at the ii-th row from the top and jj-th column from the left: si,j=s_{i,j}=# means the square is painted black, and si,j=s_{i,j}=. means it is painted white. If multiple solutions exist, printing any of them is accepted.

6
##..#.
##..#.
..##.#
..##.#
##...#
..###.

Here, there are exactly 33 #s in each row and column. Additionally, there are exactly 66 connected components of #s.