Codeforces Round 322 (Div. 2)
D
Three Logos
Codeforces
1700
原题
← CE →
翻译中…

Three companies decided to order a billboard with pictures of their logos. A billboard is a big square board. A logo of each company is a rectangle of a non-zero area.

翻译中…

Advertisers will put up the ad only if it is possible to place all three logos on the billboard so that they do not overlap and the billboard has no empty space left. When you put a logo on the billboard, you should rotate it so that the sides were parallel to the sides of the billboard.

翻译中…

Your task is to determine if it is possible to put the logos of all the three companies on some square billboard without breaking any of the described rules.

翻译中…

Input

翻译中…

The first line of the input contains six positive integers $*x*_{1}, *y*_{1}, *x*_{2}, *y*_{2}, *x*_{3}, *y*_{3}$ ($1 ≤ *x*_{1}, *y*_{1}, *x*_{2}, *y*_{2}, *x*_{3}, *y*_{3} ≤ 100$), where $*x*_{*i*}$ and $*y*_{*i*}$ determine the length and width of the logo of the $*i*$-th company respectively.

翻译中…

Output

翻译中…

If it is impossible to place all the three logos on a square shield, print a single integer "-1" (without the quotes).

翻译中…

If it is possible, print in the first line the length of a side of square $*n*$, where you can place all the three logos. Each of the next $*n*$ lines should contain $*n*$ uppercase English letters "A", "B" or "C". The sets of the same letters should form solid rectangles, provided that:

翻译中…
  • the sizes of the rectangle composed from letters "A" should be equal to the sizes of the logo of the first company,
  • the sizes of the rectangle composed from letters "B" should be equal to the sizes of the logo of the second company,
  • the sizes of the rectangle composed from letters "C" should be equal to the sizes of the logo of the third company,
翻译中…

Note that the logos of the companies can be rotated for printing on the billboard. The billboard mustn't have any empty space. If a square billboard can be filled with the logos in multiple ways, you are allowed to print any of them.

翻译中…

See the samples to better understand the statement.

翻译中…

样例

Input #1
5 1 2 5 5 2
Output #1
5
AAAAA
BBBBB
BBBBB
CCCCC
CCCCC
InputCopy OutputCopy
Input #2
4 4 2 6 4 2
Output #2
6
BBBBBB
BBBBBB
AAAACC
AAAACC
AAAACC
AAAACC
InputCopy OutputCopy
题目信息
题号
581D
时间限制
1 s
内存限制
256 MB
标签
位运算
暴力
构造
计算几何
模拟
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。