403024: GYM100971 E Bisection
Description
Pavel has developed the best game in the world — «Bisection». In this game the square grid of size n × n is given to a player. Some of the cells on the grid are selected and form a figure. A player should paint every cell of this figure in one of two colors so that the resulting figures of both colors would be equal. The figures are equal if one of them could be transformed into the other by translations, reflections relative to horizontal and vertical axes and turns by right angles.
Pavel has created an extra level for this game, but he can't understand if it has any solution. You have to find it out.
InputThe first line contains a single integer n (1 ≤ n ≤ 50) — the size of the grid.
Each of the next n lines contains n characters. The character is «.» if this cell doesn't belong to the figure, and «#» if it does.
It's guaranteed that the input contains positive even number of «#» characters.
OutputIf there is no solution, output «NO» (without quotes).
Otherwise in the first line output «YES» (without quotes), and then output n lines of n characters describing the coloring of the figure. Characters «.» from the input shouldn't be touched, and characters «#» should be replaced with «A» or «B», depending on the color that should be used to paint this cell.
If there are many possible solutions, output any of them.
ExamplesInput3Output
{.##}
{###}
{###}
YESInput
.AA
BAB
BBA
3Output
{###}
{.##}
{###}
NO