{"raw_statement":[{"iden":"statement","content":"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.\n\nPavel has created an extra level for this game, but he can't understand if it has any solution. You have to find it out.\n\nThe first line contains a single integer n (1 ≤ n ≤ 50) — the size of the grid.\n\nEach of the next n lines contains n characters. The character is «_._» if this cell doesn't belong to the figure, and «_#_» if it does.\n\nIt's guaranteed that the input contains positive even number of «_#_» characters.\n\nIf there is no solution, output «_NO_» (without quotes).\n\nOtherwise 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.\n\nIf there are many possible solutions, output any of them.\n\n"},{"iden":"input","content":"The 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."},{"iden":"output","content":"If 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."},{"iden":"examples","content":"Input3{.##}{###}{###}OutputYES.AABABBBAInput3{###}{.##}{###}OutputNO"}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ n \\in \\mathbb{Z} $, $ 1 \\leq n \\leq 50 $, be the grid size.  \nLet $ G \\subseteq \\{1, \\dots, n\\} \\times \\{1, \\dots, n\\} $ be the set of cells belonging to the figure, i.e., $ G = \\{ (i,j) \\mid \\text{grid}[i][j] = \\# \\} $.  \nLet $ |G| = 2m $ for some $ m \\in \\mathbb{Z}^+ $ (given even).  \n\nA *coloring* is a function $ c: G \\to \\{A, B\\} $ such that the two colored subsets $ G_A = c^{-1}(A) $, $ G_B = c^{-1}(B) $ satisfy $ |G_A| = |G_B| = m $, and $ G_A $ is congruent to $ G_B $ under the group of isometries generated by translations, reflections over horizontal/vertical axes, and rotations by $ 90^\\circ $.\n\n**Constraints**  \n1. $ 1 \\leq n \\leq 50 $  \n2. $ |G| $ is even and positive  \n3. The grid is given as an $ n \\times n $ matrix with entries in $ \\{ \\text{.}, \\# \\} $\n\n**Objective**  \nDetermine whether there exists a coloring $ c: G \\to \\{A, B\\} $ such that $ G_A \\cong G_B $ under the specified isometries.  \n- If yes: output \"YES\" and an $ n \\times n $ grid with $ \\# \\to A $ or $ B $, and $ \\text{.} $ unchanged.  \n- If no: output \"NO\".","simple_statement":"You are given an n×n grid with some cells marked as '#' (part of a figure) and others as '.' (empty). The total number of '#' cells is even. You need to color each '#' cell either 'A' or 'B' so that the two colored groups (A and B) are identical under rotation (90°, 180°, 270°), reflection (horizontal/vertical), and translation. If possible, output \"YES\" and the colored grid; otherwise, output \"NO\".","has_page_source":false}