Codeforces Round 322 (Div. 2) |
---|

Finished |

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

bitmasks

brute force

constructive algorithms

geometry

implementation

math

*1700

No tag edit access

The problem statement has recently been changed. View the changes.

×
D. Three Logos

time limit per test

1 secondmemory limit per test

256 megabytesinput

standard inputoutput

standard outputThree 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.

Examples

Input

5 1 2 5 5 2

Output

5

AAAAA

BBBBB

BBBBB

CCCCC

CCCCC

Input

4 4 2 6 4 2

Output

6

BBBBBB

BBBBBB

AAAACC

AAAACC

AAAACC

AAAACC

Codeforces (c) Copyright 2010-2023 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Jun/05/2023 19:26:18 (g2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|