Square Tiling

题意翻译

给定一个$n\times m$的矩阵,要求每个格子填充一个大写字母,相同大写字母组成的连通块必须是一个正方形,求字典序最小的填充方法。 比较字典序(设2个矩阵为$X$、$Y$): 令字符串$S_X=X_{1,1}X_{1,2}...X_{2,1}X_{2,2}...X_{n,m}$,$S_Y=Y_{1,1}Y_{1,2}...aY_{2,1}Y_{2,2}...Y_{n,m}$(其中$X_{i,j}$表示$X$矩阵第$i$行第$j$列的大写字母,$Y_{i,j}$同理)。 两个矩阵的字典序大小就是字符串$S_X$和字符串$S_Y$的字典序大小。 给定$n,m$,输出字典序最小的矩阵

题目描述

You have an $ n×m $ rectangle table, its cells are not initially painted. Your task is to paint all cells of the table. The resulting picture should be a tiling of the table with squares. More formally: - each cell must be painted some color (the colors are marked by uppercase Latin letters); - we will assume that two cells of the table are connected if they are of the same color and share a side; each connected region of the table must form a square. Given $ n $ and $ m $ , find lexicographically minimum coloring of the table that meets the described properties.

输入输出格式

输入格式


The first line contains two integers, $ n $ and $ m $ $ (1<=n,m<=100) $ .

输出格式


Print lexicographically minimum coloring of the table that meets the described conditions. One coloring (let's call it X) is considered lexicographically less than the other one (let's call it Y), if: - consider all the table cells from left to right and from top to bottom (first, the first cell in the first row, then the second cell in the first row and so on); - let's find in this order the first cell that has distinct colors in two colorings; - the letter that marks the color of the cell in X, goes alphabetically before the letter that marks the color of the cell in Y.

输入输出样例

输入样例 #1

1 3

输出样例 #1

ABA

输入样例 #2

2 2

输出样例 #2

AA
AA

输入样例 #3

3 4

输出样例 #3

AAAB
AAAC
AAAB