import java.util.Scanner;
import  java.lang.Math;

public class ThreeLogos{

public static void main(String args[]){

Scanner input = new Scanner(System.in);
int x1 = input.nextInt();
int y1 = input.nextInt();
int x2 = input.nextInt();
int y2 = input.nextInt();
int x3 = input.nextInt();
int y3 = input.nextInt();
int temp;
int x,y;
int area = x1*y1 + x2*y2 + x3*y3;
int s = (int) Math.sqrt((double)area);
//int ans = check(area,s,x1,x2,x3,y1,y2,y3);
//System.out.println(ans);

int ans = 0;
char[][] m = new char[s][s];
//public static int check(int area,int s,int x1,int x2,int x3,int y1,int y2,int y3){
if(s*s != area)
ans = -1;
else
{
if(x1<=y1){
temp=x1;
x1=y1;
y1=temp;
}
if(x2<=y2)
{
temp=x2;
x2=y2;
y2=temp;
}
if(x3<=y3)
{
temp=x3;
x3=y3;
y3=temp;
}
/*
System.out.println("side is "+s);
System.out.println("x1 is "+x1);
System.out.println("y1 is "+y1);
System.out.println("x2 is "+x2);
System.out.println("y2 is "+y2);
System.out.println("x3 is "+x3);
System.out.println("y3 is "+y3);
*/
int x_co = x1+x2+x3;
int y_co = y1+y2+y3;
/*
System.out.println("l is "+x_co);
System.out.println("b is "+y_co);
*/
if((y_co < s) || (x_co > (s*3)))
ans = -1;
else{
//System.out.println("Within range");
if(x3==s && y_co!=s){
//System.out.println("x3 is longest");
if(x1+y2!=s && y1+x2!=s && x1+x2!=s && y1+y2!=0)
ans = -1;
else{

if(y1==s-y3)
x=x1;
else
x=y1;

for(int i=0;i<s;i++){
for(int j=0;j<y3;j++){
m[i][j]='C';
}
}
for(int i=0;i<x;i++){
for(int j=y3;j<s;j++){
m[i][j]='A';
}
}
for(int i=x;i<s;i++){
for(int j=y3;j<s;j++){
m[i][j]='B';
}
}
}
}

if(x2==s && y_co!=s){
//System.out.println("x2 is longest");
if(x1+y3!=s && y1+x3!=s && x1+x3!=s && y1+y3!=0)
ans = -1;
else{

if(y1==s-y2)
x=x1;
else
x=y1;

for(int i=0;i<s;i++){
for(int j=0;j<y2;j++){
m[i][j]='B';
}
}
for(int i=0;i<x;i++){
for(int j=y2;j<s;j++){
m[i][j]='A';
}
}
for(int i=x;i<s;i++){
for(int j=y2;j<s;j++){
m[i][j]='C';
}
}
}
}

if(x1==s && y_co!=s){
//System.out.println("x1 is longest");
if(x2+y3!=s && y2+x3!=s && x2+x3!=s && y2+y3!=s)
ans = -1;
else{

if(y2==s-y1)
x=x2;
else
x=y2;

for(int i=0;i<s;i++){
for(int j=0;j<y1;j++){
m[i][j]='A';
}
}
for(int i=0;i<x;i++){
for(int j=y1;j<s;j++){
m[i][j]='B';
}
}
for(int i=x;i<s;i++){
for(int j=y1;j<s;j++){
m[i][j]='C';
}
}
}
}

if(y_co==s){
//System.out.println("Sum of Widths = "+s);
if(x_co!=(s*3))
ans = -1;
else{
for(int i=0;i<s;i++){
for(int j=0;j<y1;j++){
m[i][j]='A';
}
}
for(int i=0;i<s;i++){
for(int j=y1;j<y1+y2;j++){
m[i][j]='B';
}
}
for(int i=0;i<s;i++){
for(int j=y1+y2;j<s;j++){
m[i][j]='C';
}
}
}
}
else
ans=-1;
}
}

if(ans==-1)
System.out.println(-1);
else{
System.out.println(s);
for(int i=0;i<s;i++){
for(int j=0;j<s;j++){
System.out.print(m[i][j]);
}
System.out.println();
}
}

}
}


import java.util.Scanner;
import  java.lang.Math;

public class ThreeLogos{

public static void main(String args[]){

Scanner input = new Scanner(System.in);
int x1 = input.nextInt();
int y1 = input.nextInt();
int x2 = input.nextInt();
int y2 = input.nextInt();
int x3 = input.nextInt();
int y3 = input.nextInt();
int temp;
int area = x1*y1 + x2*y2 + x3*y3;
int s = (int) Math.sqrt((double)area);
//int ans = check(area,s,x1,x2,x3,y1,y2,y3);
//System.out.println(ans);

int ans = 0;
char[][] m = new char[s][s];
//public static int check(int area,int s,int x1,int x2,int x3,int y1,int y2,int y3){
if(s*s != area)
ans = -1;
else
{
if(x1<=y1){
temp=x1;
x1=y1;
y1=temp;
}
if(x2<=y2)
{
temp=x2;
x2=y2;
y2=temp;
}
if(x3<=y3)
{
temp=x3;
x3=y3;
y3=temp;
}

/*System.out.println("side is "+s);
System.out.println("x1 is "+x1);
System.out.println("y1 is "+y1);
System.out.println("x2 is "+x2);
System.out.println("y2 is "+y2);
System.out.println("x3 is "+x3);
System.out.println("y3 is "+y3);
*/
int x_co = x1+x2+x3;
int y_co = y1+y2+y3;
/*
System.out.println("l is "+x_co);
System.out.println("b is "+y_co);
*/
if((y_co < s) || (x_co > (s*3)))
ans = -1;
else{
//System.out.println("Within range");
if(x3==s && y_co!=s){
//System.out.println("x3 is longest");
if(x1+y2!=s && y1+x2!=s && x1+x2!=s)
ans = -1;
else{

for(int i=0;i<s;i++){
for(int j=0;j<y3;j++){
m[i][j]='C';
}
}
for(int i=0;i<x1;i++){
for(int j=y3;j<s;j++){
m[i][j]='A';
}
}
for(int i=x1;i<s;i++){
for(int j=y3;j<s;j++){
m[i][j]='B';
}
}
}
}
if(x2==s && y_co!=s){
//System.out.println("x2 is longest");
if(x1+y3!=s && y1+x3!=s && x1+x3!=s)
ans = -1;
else{

for(int i=0;i<s;i++){
for(int j=0;j<y2;j++){
m[i][j]='B';
}
}
for(int i=0;i<x1;i++){
for(int j=y2;j<s;j++){
m[i][j]='A';
}
}
for(int i=x1;i<s;i++){
for(int j=y2;j<s;j++){
m[i][j]='C';
}
}
}
}

if(x1==s && y_co!=s){
//System.out.println("x1 is longest");
if(x2+y3!=s && y2+x3!=s && x2+x3!=s)
ans = -1;
else{

for(int i=0;i<s;i++){
for(int j=0;j<y1;j++){
m[i][j]='A';
}
}
for(int i=0;i<x2;i++){
for(int j=y1;j<s;j++){
m[i][j]='B';
}
}
for(int i=x2;i<s;i++){
for(int j=y1;j<s;j++){
m[i][j]='C';
}
}
}
}

if(y_co==s){
//System.out.println("Sum of Widths = "+s);
if(x_co!=(s*3))
ans = -1;
else{
for(int i=0;i<s;i++){
for(int j=0;j<y1;j++){
m[i][j]='A';
}
}
for(int i=0;i<s;i++){
for(int j=y1;j<y1+y2;j++){
m[i][j]='B';
}
}
for(int i=0;i<s;i++){
for(int j=y1+y2;j<s;j++){
m[i][j]='C';
}
}
}
}
}
}

if(ans==-1)
System.out.println(-1);
else{
System.out.println(s);
for(int i=0;i<s;i++){
for(int j=0;j<s;j++){
System.out.print(m[i][j]);
}
System.out.println();
}
}

}
}


import java.util.Scanner;
import  java.lang.Math;

public class ThreeLogos{

public static void main(String args[]){

Scanner input = new Scanner(System.in);
int x1 = input.nextInt();
int y1 = input.nextInt();
int x2 = input.nextInt();
int y2 = input.nextInt();
int x3 = input.nextInt();
int y3 = input.nextInt();
int temp;
int x,y;
int area = x1*y1 + x2*y2 + x3*y3;
int s = (int) Math.sqrt((double)area);
//int ans = check(area,s,x1,x2,x3,y1,y2,y3);
//System.out.println(ans);

int ans = 0;
char[][] m = new char[s][s];
//public static int check(int area,int s,int x1,int x2,int x3,int y1,int y2,int y3){
if(s*s != area)
ans = -1;
else
{
if(x1<=y1){
temp=x1;
x1=y1;
y1=temp;
}
if(x2<=y2)
{
temp=x2;
x2=y2;
y2=temp;
}
if(x3<=y3)
{
temp=x3;
x3=y3;
y3=temp;
}
/*
System.out.println("side is "+s);
System.out.println("x1 is "+x1);
System.out.println("y1 is "+y1);
System.out.println("x2 is "+x2);
System.out.println("y2 is "+y2);
System.out.println("x3 is "+x3);
System.out.println("y3 is "+y3);
*/
int x_co = x1+x2+x3;
int y_co = y1+y2+y3;
/*
System.out.println("l is "+x_co);
System.out.println("b is "+y_co);
*/
if((y_co < s) || (x_co > (s*3)))
ans = -1;
else{
//System.out.println("Within range");
if(x3==s && y_co!=s){
//System.out.println("x3 is longest");
if(x1+y2!=s && y1+x2!=s && x1+x2!=s && y1+y2!=0)
ans = -1;
else{

if(y1==s-y3)
x=x1;
else
x=y1;

for(int i=0;i<s;i++){
for(int j=0;j<y3;j++){
m[i][j]='C';
}
}
for(int i=0;i<x;i++){
for(int j=y3;j<s;j++){
m[i][j]='A';
}
}
for(int i=x;i<s;i++){
for(int j=y3;j<s;j++){
m[i][j]='B';
}
}
}
}

if(x2==s && y_co!=s){
//System.out.println("x2 is longest");
if(x1+y3!=s && y1+x3!=s && x1+x3!=s && y1+y3!=0)
ans = -1;
else{

if(y1==s-y2)
x=x1;
else
x=y1;

for(int i=0;i<s;i++){
for(int j=0;j<y2;j++){
m[i][j]='B';
}
}
for(int i=0;i<x;i++){
for(int j=y2;j<s;j++){
m[i][j]='A';
}
}
for(int i=x;i<s;i++){
for(int j=y2;j<s;j++){
m[i][j]='C';
}
}
}
}

if(x1==s && y_co!=s){
//System.out.println("x1 is longest");
if(x2+y3!=s && y2+x3!=s && x2+x3!=s && y2+y3!=s)
ans = -1;
else{

if(y2==s-y1)
x=x2;
else
x=y2;

for(int i=0;i<s;i++){
for(int j=0;j<y1;j++){
m[i][j]='A';
}
}
for(int i=0;i<x;i++){
for(int j=y1;j<s;j++){
m[i][j]='B';
}
}
for(int i=x;i<s;i++){
for(int j=y1;j<s;j++){
m[i][j]='C';
}
}
}
}

if(y_co==s){
//System.out.println("Sum of Widths = "+s);
if(x_co!=(s*3))
ans = -1;
else{
for(int i=0;i<s;i++){
for(int j=0;j<y1;j++){
m[i][j]='A';
}
}
for(int i=0;i<s;i++){
for(int j=y1;j<y1+y2;j++){
m[i][j]='B';
}
}
for(int i=0;i<s;i++){
for(int j=y1+y2;j<s;j++){
m[i][j]='C';
}
}
}
}
}
}

if(ans==-1)
System.out.println(-1);
else{
System.out.println(s);
for(int i=0;i<s;i++){
for(int j=0;j<s;j++){
System.out.print(m[i][j]);
}
System.out.println();
}
}

}
}


//import java.io.BufferedReader;
import java.util.Scanner;
import java.lang.Math;
import java.util.Arrays;

public class Skills{

public static void main(String args[]){

//BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
//String s = r.readLine();
//String[] s1 = s.split(" ");
// parse stuff

Scanner r = new Scanner(System.in);
int n = r.nextInt();
int k = r.nextInt();
int[] a = new int[n];

for(int i=0;i<n;i++){

a[i] = r.nextInt();

}

max(a,n,k);
}

public static void max(int[] a,int n,int k){

int max=0;
int sum =0;
int sol=0;
int[] a2 = new int[n];
int[] a3 = new int[n];

//Arrays.sort(a);

for(int i=0;i<n;i++){

a2[i] = (int)Math.ceil((double)a[i]/10);
a2[i]*= 10;
sol+=a[i]/10;
a3[i] = a2[i];
a2[i]-=a[i];
//System.out.println(a2[i]);
}

Arrays.sort(a2);

/*
int dig = new int[10];

for(int i=0;i<n;i++){
dig[(a2[i])]++;
}

for(int i=1;i<10;i++){
dig[i]+=dig[i-1];
}

System.out.println(Arrays.toString(dig));

for(int i=0;i<10;i++){
a[(dig[i])]
*/

//System.out.println(Arrays.toString(a));
//System.out.println(Arrays.toString(a2));
//System.out.println(Arrays.toString(a3));

for(int i=0;i<n && k>=0;i++){

if(a2[i]<=k && a2[i]>0){

k-=a2[i];
//a[i]=a3[i];
sol++;
//System.out.println(k);

}

}

//System.out.println("sol is:"+sol);

if(k>10){

for(int i=n-1;i>=0;i--){

sum+=100-a3[i];

}

if(sum<k)
sol+=sum/10;
else if(sum!=0)
sol+=k/10;
}

//System.out.println(Arrays.toString(a));
System.out.println(sol);

}
}


import java.util.Scanner;
import  java.lang.Math;

public class ThreeLogos{

public static void main(String args[]){

Scanner input = new Scanner(System.in);
int x1 = input.nextInt();
int y1 = input.nextInt();
int x2 = input.nextInt();
int y2 = input.nextInt();
int x3 = input.nextInt();
int y3 = input.nextInt();
int temp;
int area = x1*y1 + x2*y2 + x3*y3;
int s = (int) Math.sqrt((double)area);
//int ans = check(area,s,x1,x2,x3,y1,y2,y3);
//System.out.println(ans);

int ans = 0;
char[][] m = new char[s][s];
//public static int check(int area,int s,int x1,int x2,int x3,int y1,int y2,int y3){
if(s*s != area)
ans = -1;
else
{
if(x1<=y1){
temp=x1;
x1=y1;
y1=temp;
}
if(x2<=y2)
{
temp=x2;
x2=y2;
y2=temp;
}
if(x3<=y3)
{
temp=x3;
x3=y3;
y3=temp;
}

/*System.out.println("side is "+s);
System.out.println("x1 is "+x1);
System.out.println("y1 is "+y1);
System.out.println("x2 is "+x2);
System.out.println("y2 is "+y2);
System.out.println("x3 is "+x3);
System.out.println("y3 is "+y3);
*/
int x_co = x1+x2+x3;
int y_co = y1+y2+y3;
/*
System.out.println("l is "+x_co);
System.out.println("b is "+y_co);
*/
if((y_co < s) || (x_co > (s*3)))
ans = -1;
else{
//System.out.println("Within range");
if(x3==s && y_co!=s){
//System.out.println("x3 is longest");
if(x1+y2!=s && y1+x2!=s && x1+x2!=s)
ans = -1;
else{

for(int i=0;i<s;i++){
for(int j=0;j<y3;j++){
m[i][j]='C';
}
}
for(int i=0;i<s-x1;i++){
for(int j=y3;j<s;j++){
m[i][j]='A';
}
}
for(int i=s-x1;i<s;i++){
for(int j=y3;j<s;j++){
m[i][j]='B';
}
}
}
}
if(x2==s && y_co!=s){
//System.out.println("x2 is longest");
if(x1+y3!=s && y1+x3!=s && x1+x3!=s)
ans = -1;
else{

for(int i=0;i<s;i++){
for(int j=0;j<y2;j++){
m[i][j]='B';
}
}
for(int i=0;i<s-x1;i++){
for(int j=y2;j<s;j++){
m[i][j]='A';
}
}
for(int i=s-x1;i<s;i++){
for(int j=y2;j<s;j++){
m[i][j]='C';
}
}
}
}

if(x1==s && y_co!=s){
//System.out.println("x1 is longest");
if(x2+y3!=s && y2+x3!=s && x2+x3!=s)
ans = -1;
else{

for(int i=0;i<s;i++){
for(int j=0;j<y1;j++){
m[i][j]='A';
}
}
for(int i=0;i<s-x2;i++){
for(int j=y1;j<s;j++){
m[i][j]='B';
}
}
for(int i=s-x2;i<s;i++){
for(int j=y1;j<s;j++){
m[i][j]='C';
}
}
}
}

if(y_co==s){
//System.out.println("Sum of Widths = "+s);
if(x_co!=(s*3))
ans = -1;
else{
for(int i=0;i<s;i++){
for(int j=0;j<y1;j++){
m[i][j]='A';
}
}
for(int i=0;i<s;i++){
for(int j=y1;j<y1+y2;j++){
m[i][j]='B';
}
}
for(int i=0;i<s;i++){
for(int j=y1+y2;j<s;j++){
m[i][j]='C';
}
}
}
}
}
}

if(ans==-1)
System.out.println(-1);
else{
System.out.println(s);
for(int i=0;i<s;i++){
for(int j=0;j<s;j++){
System.out.print(m[i][j]);
}
System.out.println();
}
}

}
}


import java.io.*;
import java.util.*;

/**
 * 581D
 * O(max(cs[i][j])^2) time
 * O(max(cs[i][j])^2) space
 *
 * @author artyom
 */
public class _581D implements Runnable {
    private static final char[] c = new char[]{'A', 'B', 'C'};
    private static final int[][] ps = new int[][]{
            {0, 1, 2},
            {0, 2, 1},
            {1, 0, 2},
            {1, 2, 1},
            {2, 0, 1},
            {2, 1, 0}
    };
    private static final Set[] ss = new Set[]{
            Collections.emptySet(),
            Collections.singleton(0),
            Collections.singleton(1),
            Collections.singleton(2),
            new HashSet<>(Arrays.asList(0, 1)),
            new HashSet<>(Arrays.asList(0, 2)),
            new HashSet<>(Arrays.asList(1, 2)),
            new HashSet<>(Arrays.asList(0, 1, 2)),
    };
    private BufferedReader in;
    private StringTokenizer tok;

    private Object solve() throws IOException {
        int[][] cs = new int[][]{
                {nextInt(), nextInt()},
                {nextInt(), nextInt()},
                {nextInt(), nextInt()}
        };
        for (int k = 0; k < 8; k++) {
            for (int i = 0; i < 3; i++) {
                if (ss[k].contains(i)) {
                    int tmp = cs[i][0];
                    cs[i][0] = cs[i][1];
                    cs[i][1] = tmp;
                }
            }
            StringBuilder sb = attempt(cs);
            if (sb != null) {
                return sb;
            }
            for (int i = 0; i < 3; i++) {
                if (ss[k].contains(i)) {
                    int tmp = cs[i][0];
                    cs[i][0] = cs[i][1];
                    cs[i][1] = tmp;
                }
            }
        }
        return -1;
    }

    private StringBuilder attempt(int[][] cs) {
        int x = cs[0][0] + cs[1][0] + cs[2][0];
        if (x == cs[0][1] && x == cs[1][1] && x == cs[2][1]) {
            StringBuilder sb = new StringBuilder().append(cs[0][1]).append('\n');
            for (int i = 0; i < cs[0][0]; i++) {
                for (int j = 0; j < cs[0][1]; j++) {
                    sb.append('A');
                }
                sb.append('\n');
            }
            for (int i = 0; i < cs[1][0]; i++) {
                for (int j = 0; j < cs[0][1]; j++) {
                    sb.append('B');
                }
                sb.append('\n');
            }
            for (int i = 1; i <= cs[2][0]; i++) {
                for (int j = 0; j < cs[0][1]; j++) {
                    sb.append('C');
                }
                if (i < cs[2][0]) {
                    sb.append('\n');
                }
            }
            return sb;
        }
        for (int k = 0; k < 6; k++) {
            if (cs[ps[k][0]][1] == cs[ps[k][1]][1] + cs[ps[k][2]][1] && cs[ps[k][1]][0] == cs[ps[k][2]][0] && cs[ps[k][0]][1] == cs[ps[k][1]][0] + cs[ps[k][0]][0]) {
                StringBuilder sb = new StringBuilder().append(cs[ps[k][0]][1]).append('\n');
                for (int i = 0; i < cs[ps[k][0]][0]; i++) {
                    for (int j = 0; j < cs[ps[k][0]][1]; j++) {
                        sb.append(c[ps[k][0]]);
                    }
                    sb.append('\n');
                }
                for (int i = 1; i <= cs[ps[k][1]][0]; i++) {
                    for (int j = 0; j < cs[ps[k][1]][1]; j++) {
                        sb.append(c[ps[k][1]]);
                    }
                    for (int j = 0; j < cs[ps[k][2]][1]; j++) {
                        sb.append(c[ps[k][2]]);
                    }
                    if (i < cs[ps[k][1]][0]) {
                        sb.append('\n');
                    }
                }
                return sb;
            }
        }
        return null;
    }

    //--------------------------------------------------------------
    public static void main(String[] args) {
        new _581D().run();
    }

    @Override
    public void run() {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            tok = null;
            System.out.print(solve());
            in.close();
        } catch (IOException e) {
            System.exit(0);
        }
    }

    private String nextToken() throws IOException {
        while (tok == null || !tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    private int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
}


import java.io.*;
import java.util.*;

/**
 * 581D
 * O(max(cs[i][j])^2) time
 * O(max(cs[i][j])^2) space
 *
 * @author artyom
 */
public class _581D implements Runnable {
    private static final char[] c = new char[]{'A', 'B', 'C'};
    private static final int[][] ps = new int[][]{
            {0, 1, 2},
            {0, 2, 1},
            {1, 0, 2},
            {1, 2, 1},
            {2, 0, 1},
            {2, 1, 0}
    };
    private static final Set[] ss = new Set[]{
            Collections.emptySet(),
            Collections.singleton(0),
            Collections.singleton(1),
            Collections.singleton(2),
            new HashSet<>(Arrays.asList(0, 1)),
            new HashSet<>(Arrays.asList(0, 2)),
            new HashSet<>(Arrays.asList(1, 2)),
    };
    private BufferedReader in;
    private StringTokenizer tok;

    private Object solve() throws IOException {
        int[][] cs = new int[][]{
                {nextInt(), nextInt()},
                {nextInt(), nextInt()},
                {nextInt(), nextInt()}
        };
        for (int k = 0; k < 7; k++) {
            for (int i = 0; i < 3; i++) {
                if (ss[k].contains(i)) {
                    int tmp = cs[i][0];
                    cs[i][0] = cs[i][1];
                    cs[i][1] = tmp;
                }
            }
            StringBuilder sb = attempt(cs);
            if (sb != null) {
                return sb;
            }
            for (int i = 0; i < 3; i++) {
                if (ss[k].contains(i)) {
                    int tmp = cs[i][0];
                    cs[i][0] = cs[i][1];
                    cs[i][1] = tmp;
                }
            }
        }
        return -1;
    }

    private StringBuilder attempt(int[][] cs) {
        int x = cs[0][0] + cs[1][0] + cs[2][0];
        if (x == cs[0][1] && x == cs[1][1] && x == cs[2][1]) {
            StringBuilder sb = new StringBuilder().append(cs[0][1]).append('\n');
            for (int i = 0; i < cs[0][0]; i++) {
                for (int j = 0; j < cs[0][1]; j++) {
                    sb.append('A');
                }
                sb.append('\n');
            }
            for (int i = 0; i < cs[1][0]; i++) {
                for (int j = 0; j < cs[0][1]; j++) {
                    sb.append('B');
                }
                sb.append('\n');
            }
            for (int i = 1; i <= cs[2][0]; i++) {
                for (int j = 0; j < cs[0][1]; j++) {
                    sb.append('C');
                }
                if (i < cs[2][0]) {
                    sb.append('\n');
                }
            }
            return sb;
        }
        for (int k = 0; k < 6; k++) {
            if (cs[ps[k][0]][1] == cs[ps[k][1]][1] + cs[ps[k][2]][1] && cs[ps[k][1]][0] == cs[ps[k][2]][0] && cs[ps[k][0]][1] == cs[ps[k][1]][0] + cs[ps[k][0]][0]) {
                StringBuilder sb = new StringBuilder().append(cs[ps[k][0]][1]).append('\n');
                for (int i = 0; i < cs[ps[k][0]][0]; i++) {
                    for (int j = 0; j < cs[ps[k][0]][1]; j++) {
                        sb.append(c[ps[k][0]]);
                    }
                    sb.append('\n');
                }
                for (int i = 1; i <= cs[ps[k][1]][0]; i++) {
                    for (int j = 0; j < cs[ps[k][1]][1]; j++) {
                        sb.append(c[ps[k][1]]);
                    }
                    for (int j = 0; j < cs[ps[k][2]][1]; j++) {
                        sb.append(c[ps[k][2]]);
                    }
                    if (i < cs[ps[k][1]][0]) {
                        sb.append('\n');
                    }
                }
                return sb;
            }
        }
        return null;
    }

    //--------------------------------------------------------------
    public static void main(String[] args) {
        new _581D().run();
    }

    @Override
    public void run() {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            tok = null;
            System.out.print(solve());
            in.close();
        } catch (IOException e) {
            System.exit(0);
        }
    }

    private String nextToken() throws IOException {
        while (tok == null || !tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    private int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int[] x = new int[3], y = new int[3];
            char[] chr = new char[]{'A', 'B', 'C'};
            for (int i = 0; i < 3; ++i) {
                x[i] = in.nextInt();
                y[i] = in.nextInt();
            }
            for (int conf = 0; conf < 8; ++conf) {
                int[] arg = new int[6];
                for (int i = 0; i < 3; ++i) {
                    if ((conf & (1 << i)) == 0) {
                        arg[2 * i] = x[i];
                        arg[2 * i + 1] = y[i];
                    } else {
                        arg[2 * i] = y[i];
                        arg[2 * i + 1] = x[i];
                    }
                }
                if (try1(arg[0], arg[1], arg[2], arg[3], arg[4], arg[5], out)) return;
            }

            for (int top = 0; top < 3; ++top) {
                swap(x, 0, top);
                swap(y, 0, top);
                swap(chr, 0, top);
                for (int conf = 0; conf < 8; ++conf) {
                    int[] arg = new int[6];
                    for (int i = 0; i < 3; ++i) {
                        if ((conf & (1 << i)) == 0) {
                            arg[2 * i] = x[i];
                            arg[2 * i + 1] = y[i];
                        } else {
                            arg[2 * i] = y[i];
                            arg[2 * i + 1] = x[i];
                        }
                    }
                    if (try2(arg[0], arg[1], arg[2], arg[3], arg[4], arg[5],
                            chr[0], chr[1], chr[2], out)) return;
                }

                swap(x, 0, top);
                swap(y, 0, top);
                swap(chr, 0, top);
            }

            out.println(-1);
        }

        private boolean try1(int x1, int y1, int x2, int y2, int x3, int y3, PrintWriter out) {
            if (y1 == y2 && y2 == y3 && x1 + x2 + x3 == y1) {
                out.println(y1);
                char[] A = new char[y1];
                for (int i = 0; i < y1; ++i)
                    A[i] = 'A';
                String S = new String(A);
                for (int i = 0; i < x1; ++i) out.println(S);
                for (int i = 0; i < y1; ++i)
                    A[i] = 'B';
                S = new String(A);
                for (int i = 0; i < x2; ++i) out.println(S);
                for (int i = 0; i < y1; ++i)
                    A[i] = 'C';
                S = new String(A);
                for (int i = 0; i < x3; ++i) out.println(S);
                return true;
            }
            return false;
        }

        private boolean try2(int x1, int y1, int x2, int y2, int x3, int y3,
                             char c1, char c2, char c3, PrintWriter out) {
            if (x2 == x3 && x1 + x2 == y1 && y1 == y2 + y3) {
                out.println(y1);
                char[] A = new char[y1];
                for (int i = 0; i < y1; ++i)
                    A[i] = c1;
                String S = new String(A);
                for (int i = 0; i < x1; ++i)
                    out.println(S);

                for (int i = 0; i < y2; ++i)
                    A[i] = c2;
                for (int i = y2; i < y2 + y3; ++i)
                    A[i] = c3;
                S = new String(A);
                for (int i = 0; i < x2; ++i)
                    out.println(S);
                return true;
            }
            return false;
        }

        private void swap(int[] a, int i, int j) {
            int aux = a[i];
            a[i] = a[j];
            a[j] = aux;
        }

        private void swap(char[] a, int i, int j) {
            char aux = a[i];
            a[i] = a[j];
            a[j] = aux;
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new UnknownError();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new UnknownError();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public String next() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuffer res = new StringBuffer();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));

            return res.toString();
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class D {

	public static void main(String[] args) throws IOException {
		try {
		   BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
		    String in = input.readLine();
		    String[] init = in.split(" ");

		    int x1 = Integer.parseInt(init[0]);
		    int y1 = Integer.parseInt(init[1]);

		    int x2 = Integer.parseInt(init[2]);
		    int y2 = Integer.parseInt(init[3]);

		    int x3 = Integer.parseInt(init[4]);
		    int y3 = Integer.parseInt(init[5]);

		    int s = (int) Math.sqrt(x1 * y1 + x2 * y2 + x3 * y3);
		    char[][] b = new char[s][s];

		    int r = s;

		    boolean[] zz = new boolean[3];

		    if(x1 == s){
		    	for(int i = 0; i < y1; i++){
		    		Arrays.fill(b[i], 'A');
		    		zz[0] = true;
		    	}
		    	r = s - y1;
		    } else if(x2 == s){
		    	for(int i = 0; i < y2; i++){
		    		Arrays.fill(b[i], 'B');
		    		zz[1] = true;

		    	}
		    	r = s - y2;
		    } else if(x3 == s){
		    	for(int i = 0; i < y3; i++){
		    		Arrays.fill(b[i], 'C');
		    		zz[2] = true;

		    	}
		    	r = s - y3;
		    } else if(y1 == s){
		    	for(int i = 0; i < x1; i++){
		    		Arrays.fill(b[i], 'A');
		    	}
	    		zz[0] = true;
		    	r = s - x1;
		    } else if(y2 == s){
		    	for(int i = 0; i < x2; i++){
		    		Arrays.fill(b[i], 'B');
		    	}
		    	r = s - x2;
	    		zz[1] = true;
		    } else if(y3 == s){
		    	for(int i = 0; i < x3; i++){
		    		Arrays.fill(b[i], 'C');
		    	}
		    	r = s - x3;
	    		zz[2] = true;
		    } else {
		    	System.out.println("-1");
		    	return;
		    }

		    //rect of s x r to fill.
		    boolean x = false;
		    if(zz[0]){
		    	x |= fill('B', 'C', x2, y2, x3, y3, s, r, b);
		    } else if (zz[1]){
		    	x |= fill('A', 'C', x1, y1, x3, y3, s, r, b);
		    } else if (zz[2]){
		    	x |= fill('A', 'B', x1, y1, x2, y2, s, r, b);
		    }

		    if(x){
		    	System.out.println(s);
		    	for(int i = 0; i < s; i++){
		    		System.out.println(String.copyValueOf(b[i]));
		    	}
		    }
		} catch(Exception e){
			System.out.println("-1");
		}
	}

	private static boolean fill(char c1, char c2, int x1, int y1, int x2, int y2, int s, int r, char[][] b) {

		boolean se = false;

		 if (r == y1){
	    	for(int i = 0; i < x1; i++){
	    		for(int k = s - r; k < s; k++){
	    			b[k][i] = c1;
	    		}
	    	}
    		s = s - x1;

		} else if (r == x1){
	    	for(int i = 0; i < y1; i++){
	    		for(int k = s - r; k < s; k++){
	    			b[k][i] = c1;
	    		}
	    	}
    		s = s - y1;

		}  else if (s == x1){
	    	for(int i = s - r; i < s - r + y1; i++){
	    		Arrays.fill(b[i], c1);

	    	}
    		r = r - y1;
		} else if (s == y1){
	    	for(int i = s - r; i < s - r + x1; i++){
	    		Arrays.fill(b[i], c1);
	    	}
    		r = r - x1;
		} else {
			System.out.println("-1");
					return false;
		}

			if(x2 == r){
		    	for(int i = b.length - s; i < b.length; i++){
		    		for(int k = b.length - r; k < b.length; k++){
		    			b[k][i] = c2;
		    		}
		    	}
			} else if(y2 == r){
		    	for(int i = b.length - s; i < b.length; i++){
		    		for(int k = b.length - r; k < b.length; k++){
		    			b[k][i] = c2;
		    		}
		    	}
			} else {
				System.out.println("-1");
				return false;
			}

		return true;

	}

	}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class D {

	public static void main(String[] args) throws IOException {
		   BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
		    String in = input.readLine();
		    String[] init = in.split(" ");

		    int x1 = Integer.parseInt(init[0]);
		    int y1 = Integer.parseInt(init[1]);

		    int x2 = Integer.parseInt(init[2]);
		    int y2 = Integer.parseInt(init[3]);

		    int x3 = Integer.parseInt(init[4]);
		    int y3 = Integer.parseInt(init[5]);

		    int s = (int) Math.sqrt(x1 * y1 + x2 * y2 + x3 * y3);
		    char[][] b = new char[s][s];

		    int r = s;

		    boolean[] zz = new boolean[3];

		    if(x1 == s){
		    	for(int i = 0; i < y1; i++){
		    		Arrays.fill(b[i], 'A');
		    		zz[0] = true;
		    	}
		    	r = s - y1;
		    } else if(x2 == s){
		    	for(int i = 0; i < y2; i++){
		    		Arrays.fill(b[i], 'B');
		    		zz[1] = true;

		    	}
		    	r = s - y2;
		    } else if(x3 == s){
		    	for(int i = 0; i < y3; i++){
		    		Arrays.fill(b[i], 'C');
		    		zz[2] = true;

		    	}
		    	r = s - y3;
		    } else if(y1 == s){
		    	for(int i = 0; i < x1; i++){
		    		Arrays.fill(b[i], 'A');
		    	}
	    		zz[0] = true;
		    	r = s - x1;
		    } else if(y2 == s){
		    	for(int i = 0; i < x2; i++){
		    		Arrays.fill(b[i], 'B');
		    	}
		    	r = s - x2;
	    		zz[1] = true;
		    } else if(y3 == s){
		    	for(int i = 0; i < x3; i++){
		    		Arrays.fill(b[i], 'C');
		    	}
		    	r = s - x3;
	    		zz[2] = true;
		    } else {
		    	System.out.println("-1");
		    	return;
		    }

		    //rect of s x r to fill.
		    boolean x = false;
		    if(zz[0]){
		    	x |= fill('B', 'C', x2, y2, x3, y3, s, r, b);
		    } else if (zz[1]){
		    	x |= fill('A', 'C', x1, y1, x3, y3, s, r, b);
		    } else if (zz[2]){
		    	x |= fill('A', 'B', x1, y1, x2, y2, s, r, b);
		    }

		    if(x){
		    	System.out.println(s);
		    	for(int i = 0; i < s; i++){
		    		System.out.println(String.copyValueOf(b[i]));
		    	}
		    }
	}

	private static boolean fill(char c1, char c2, int x1, int y1, int x2, int y2, int s, int r, char[][] b) {

		boolean se = false;

		 if (r == y1){
	    	for(int i = 0; i < x1; i++){
	    		for(int k = s - r; k < s; k++){
	    			b[k][i] = c1;
	    		}
	    	}
    		s = s - x1;

		} else if (r == x1){
	    	for(int i = 0; i < y1; i++){
	    		for(int k = s - r; k < s; k++){
	    			b[k][i] = c1;
	    		}
	    	}
    		s = s - y1;

		}  else if (s == x1){
	    	for(int i = s - r; i < s - r + y1; i++){
	    		Arrays.fill(b[i], c1);

	    	}
    		r = r - y1;
		} else if (s == y1){
	    	for(int i = s - r; i < s - r + x1; i++){
	    		Arrays.fill(b[i], c1);
	    	}
    		r = r - x1;
		} else {
			System.out.println("-1");
					return false;
		}

			if(x2 == r){
		    	for(int i = b.length - s; i < b.length; i++){
		    		for(int k = b.length - r; k < b.length; k++){
		    			b[k][i] = c2;
		    		}
		    	}
			} else if(y2 == r){
		    	for(int i = b.length - s; i < b.length; i++){
		    		for(int k = b.length - r; k < b.length; k++){
		    			b[k][i] = c2;
		    		}
		    	}
			} else {
				System.out.println("-1");
				return false;
			}

		return true;

	}

	}


import java.util.Scanner;

public class q4
{

    public static void main(String args[])
    {
        Scanner s=new Scanner(System.in);
        int x=s.nextInt();
        int y=s.nextInt();
        int a1=Math.max(x, y);
        int a2=Math.min(x, y);

         x=s.nextInt();
         y=s.nextInt();
        int b1=Math.max(x, y);
        int b2=Math.min(x, y);

         x=s.nextInt();
         y=s.nextInt();
        int c1=Math.max(x, y);
        int c2=Math.min(x, y);

        if(a1==b1 && b1==c1 && a2==b2 && b2==c2 && a1==a2)
        {
            System.out.println(-1);
            return;
        }
        int max=Math.max(c1, Math.max(a1, b1));

        if(max==a1)
        {
            print(a1,a2,"A",b1,b2,"B",c1,c2,"C",max);
        }
        else
            if(max==b1)
            {

                print(b1,b2,"B",a1,a2,"A",c1,c2,"C",max);
            }
            else
                if(max==c1)
                {
                    print(c1,c2,"C",b1,b2,"B",a1,a2,"A",max);
                }

    }

    public static void print(int a1,int a2,String a,int b1,int b2,String b,int c1,int c2,String c,int max)
    {

        int r=a2;
        StringBuilder ans=new StringBuilder();
        ans.append(max+"\n");
        for(int i=0;i<a2;i++)
            {
            for(int j=0;j<a1;j++)
            ans.append(a);

            ans.append("\n");
            }

        if(a1==b1&& b1==c1)
        {
            for(int i=0;i<b2;i++)
            {
            for(int j=0;j<a1;j++)
            ans.append(b);

            ans.append("\n");
            }

            for(int i=0;i<c2;i++)
            {
            for(int j=0;j<a1;j++)
            ans.append(c);

            ans.append("\n");
            }
        }
        else
        {
            if(b1==c1 && b1+r==max && b2+c2==max)
            {
                for(int i=0;i<b1;i++)
                {
                    int j=0;
                    for(j=0;j<b2;j++)
                    {
                        ans.append(b);
                    }
                    for(j=0;j<c2;j++)
                    {
                        ans.append(c);
                    }
                    ans.append("\n");

                }
            }
            else
                if(b1==c2 && b1+r==max && b2+c1==max)
                {
                    for(int i=0;i<b1;i++)
                    {
                        int j=0;
                        for(j=0;j<b2;j++)
                        {
                            ans.append(b);
                        }
                        for(j=0;j<c1;j++)
                        {
                            ans.append(c);
                        }
                        ans.append("\n");

                    }
                }
                else
                    if(b2==c1 && b2+r==max && b1+c2==max)
                    {
                        for(int i=0;i<b2;i++)
                        {
                            int j=0;
                            for(j=0;j<b1;j++)
                            {
                                ans.append(b);
                            }
                            for(j=0;j<c2;j++)
                            {
                                ans.append(c);
                            }
                            ans.append("\n");

                        }
                    }
                    else
                        if(b2==c2 && b2+r==max && b1+c1==max)
                        {
                            for(int i=0;i<b2;i++)
                            {
                                int j=0;
                                for(j=0;j<b1;j++)
                                {
                                    ans.append(b);
                                }
                                for(j=0;j<c1;j++)
                                {
                                    ans.append(c);
                                }
                                ans.append("\n");

                            }
                        }
                        else
                        {
                            System.out.println(-1);return;
                        }
        }

        System.out.println(ans);
    }

}


import java.util.Scanner;

public class q4
{

    public static void main(String args[])
    {
        Scanner s=new Scanner(System.in);
        int x=s.nextInt();
        int y=s.nextInt();
        int a1=Math.max(x, y);
        int a2=Math.min(x, y);

         x=s.nextInt();
         y=s.nextInt();
        int b1=Math.max(x, y);
        int b2=Math.min(x, y);

         x=s.nextInt();
         y=s.nextInt();
        int c1=Math.max(x, y);
        int c2=Math.min(x, y);

        if(a1==b1 && b1==c1 && a2==b2 && b2==c2 && a1==a2)
        {
            System.out.println(-1);
            return;
        }
        int max=Math.max(c1, Math.max(a1, b1));

        if(max==a1)
        {
            print(a1,a2,"A",b1,b2,"B",c1,c2,"C",max);
        }
        else
            if(max==b1)
            {

                print(b1,b2,"B",a1,a2,"A",c1,c2,"C",max);
            }
            else
                if(max==c1)
                {
                    print(c1,c2,"C",b1,b2,"B",a1,a2,"A",max);
                }

    }

    public static void print(int a1,int a2,String a,int b1,int b2,String b,int c1,int c2,String c,int max)
    {

        int r=a2;
        StringBuilder ans=new StringBuilder();
        ans.append(max+"\n");
        for(int i=0;i<a2;i++)
            {
            for(int j=0;j<a1;j++)
            ans.append(a);

            ans.append("\n");
            }

        if(a1==b1&& b1==c1 && b2+c2+r==max)
        {
            for(int i=0;i<b2;i++)
            {
            for(int j=0;j<a1;j++)
            ans.append(b);

            ans.append("\n");
            }

            for(int i=0;i<c2;i++)
            {
            for(int j=0;j<a1;j++)
            ans.append(c);

            ans.append("\n");
            }
        }
        else
        {
            if(b1==c1 && b1+r==max && b2+c2==max)
            {
                for(int i=0;i<b1;i++)
                {
                    int j=0;
                    for(j=0;j<b2;j++)
                    {
                        ans.append(b);
                    }
                    for(j=0;j<c2;j++)
                    {
                        ans.append(c);
                    }
                    ans.append("\n");

                }
            }
            else
                if(b1==c2 && b1+r==max && b2+c1==max)
                {
                    for(int i=0;i<b1;i++)
                    {
                        int j=0;
                        for(j=0;j<b2;j++)
                        {
                            ans.append(b);
                        }
                        for(j=0;j<c1;j++)
                        {
                            ans.append(c);
                        }
                        ans.append("\n");

                    }
                }
                else
                    if(b2==c1 && b2+r==max && b1+c2==max)
                    {
                        for(int i=0;i<b2;i++)
                        {
                            int j=0;
                            for(j=0;j<b1;j++)
                            {
                                ans.append(b);
                            }
                            for(j=0;j<c2;j++)
                            {
                                ans.append(c);
                            }
                            ans.append("\n");

                        }
                    }
                    else
                        if(b2==c2 && b2+r==max && b1+c1==max)
                        {
                            for(int i=0;i<b2;i++)
                            {
                                int j=0;
                                for(j=0;j<b1;j++)
                                {
                                    ans.append(b);
                                }
                                for(j=0;j<c1;j++)
                                {
                                    ans.append(c);
                                }
                                ans.append("\n");

                            }
                        }
                        else
                        {
                            System.out.println(-1);return;
                        }
        }

        System.out.println(ans);
    }

}


import java.util.Scanner;

public class q4
{

    public static void main(String args[])
    {
        Scanner s=new Scanner(System.in);
        int x=s.nextInt();
        int y=s.nextInt();
        int a1=Math.max(x, y);
        int a2=Math.min(x, y);

         x=s.nextInt();
         y=s.nextInt();
        int b1=Math.max(x, y);
        int b2=Math.min(x, y);

         x=s.nextInt();
         y=s.nextInt();
        int c1=Math.max(x, y);
        int c2=Math.min(x, y);

        if(a1==b1 && b1==c1 && a2==b2 && b2==c2)
        {
            System.out.println(-1);
            return;
        }
        int max=Math.max(c1, Math.max(a1, b1));

        if(max==a1)
        {
            print(a1,a2,"A",b1,b2,"B",c1,c2,"C",max);
        }
        else
            if(max==b1)
            {

                print(b1,b2,"B",a1,a2,"A",c1,c2,"C",max);
            }
            else
                if(max==c1)
                {
                    print(c1,c2,"C",b1,b2,"B",a1,a2,"A",max);
                }

    }

    public static void print(int a1,int a2,String a,int b1,int b2,String b,int c1,int c2,String c,int max)
    {

        int r=a2;
        StringBuilder ans=new StringBuilder();
        ans.append(max+"\n");
        for(int i=0;i<a2;i++)
            {
            for(int j=0;j<a1;j++)
            ans.append(a);

            ans.append("\n");
            }

        if(a1==b1&& b1==c1)
        {
            for(int i=0;i<b2;i++)
            {
            for(int j=0;j<a1;j++)
            ans.append(b);

            ans.append("\n");
            }

            for(int i=0;i<c2;i++)
            {
            for(int j=0;j<a1;j++)
            ans.append(c);

            ans.append("\n");
            }
        }
        else
        {
            if(b1==c1 && b1+r==max && b2+c2==max)
            {
                for(int i=0;i<b1;i++)
                {
                    int j=0;
                    for(j=0;j<b2;j++)
                    {
                        ans.append(b);
                    }
                    for(j=0;j<c2;j++)
                    {
                        ans.append(c);
                    }
                    ans.append("\n");

                }
            }
            else
                if(b1==c2 && b1+r==max && b2+c1==max)
                {
                    for(int i=0;i<b1;i++)
                    {
                        int j=0;
                        for(j=0;j<b2;j++)
                        {
                            ans.append(b);
                        }
                        for(j=0;j<c1;j++)
                        {
                            ans.append(c);
                        }
                        ans.append("\n");

                    }
                }
                else
                    if(b2==c1 && b2+r==max && b1+c2==max)
                    {
                        for(int i=0;i<b2;i++)
                        {
                            int j=0;
                            for(j=0;j<b1;j++)
                            {
                                ans.append(b);
                            }
                            for(j=0;j<c2;j++)
                            {
                                ans.append(c);
                            }
                            ans.append("\n");

                        }
                    }
                    else
                        if(b2==c2 && b2+r==max && b1+c1==max)
                        {
                            for(int i=0;i<b2;i++)
                            {
                                int j=0;
                                for(j=0;j<b1;j++)
                                {
                                    ans.append(b);
                                }
                                for(j=0;j<c1;j++)
                                {
                                    ans.append(c);
                                }
                                ans.append("\n");

                            }
                        }
                        else
                        {
                            System.out.println(-1);return;
                        }
        }

        System.out.println(ans);
    }

}


import java.util.Scanner;

public class q4
{

    public static void main(String args[])
    {
        Scanner s=new Scanner(System.in);
        int x=s.nextInt();
        int y=s.nextInt();
        int a1=Math.max(x, y);
        int a2=Math.min(x, y);

         x=s.nextInt();
         y=s.nextInt();
        int b1=Math.max(x, y);
        int b2=Math.min(x, y);

         x=s.nextInt();
         y=s.nextInt();
        int c1=Math.max(x, y);
        int c2=Math.min(x, y);

        int max=Math.max(c1, Math.max(a1, b1));

        if(max==a1)
        {
            print(a1,a2,"A",b1,b2,"B",c1,c2,"C",max);
        }
        else
            if(max==b1)
            {

                print(b1,b2,"B",a1,a2,"A",c1,c2,"C",max);
            }
            else
                if(max==c1)
                {
                    print(c1,c2,"C",b1,b2,"B",a1,a2,"A",max);
                }

    }

    public static void print(int a1,int a2,String a,int b1,int b2,String b,int c1,int c2,String c,int max)
    {

        int r=a2;
        StringBuilder ans=new StringBuilder();
        ans.append(max+"\n");
        for(int i=0;i<a2;i++)
            {
            for(int j=0;j<a1;j++)
            ans.append(a);

            ans.append("\n");
            }

        if(a1==b1&& b1==c1 && b2+c2+r==max)
        {
            for(int i=0;i<b2;i++)
            {
            for(int j=0;j<a1;j++)
            ans.append(b);

            ans.append("\n");
            }

            for(int i=0;i<c2;i++)
            {
            for(int j=0;j<a1;j++)
            ans.append(c);

            ans.append("\n");
            }
        }
        else
        {
            if(b1==c1 && b1+r==max && b2+c2==max)
            {
                for(int i=0;i<b1;i++)
                {
                    int j=0;
                    for(j=0;j<b2;j++)
                    {
                        ans.append(b);
                    }
                    for(j=0;j<c2;j++)
                    {
                        ans.append(c);
                    }
                    ans.append("\n");

                }
            }
            else
                if(b1==c2 && b1+r==max && b2+c1==max)
                {
                    for(int i=0;i<b1;i++)
                    {
                        int j=0;
                        for(j=0;j<b2;j++)
                        {
                            ans.append(b);
                        }
                        for(j=0;j<c1;j++)
                        {
                            ans.append(c);
                        }
                        ans.append("\n");

                    }
                }
                else
                    if(b2==c1 && b2+r==max && b1+c2==max)
                    {
                        for(int i=0;i<b2;i++)
                        {
                            int j=0;
                            for(j=0;j<b1;j++)
                            {
                                ans.append(b);
                            }
                            for(j=0;j<c2;j++)
                            {
                                ans.append(c);
                            }
                            ans.append("\n");

                        }
                    }
                    else
                        if(b2==c2 && b2+r==max && b1+c1==max)
                        {
                            for(int i=0;i<b2;i++)
                            {
                                int j=0;
                                for(j=0;j<b1;j++)
                                {
                                    ans.append(b);
                                }
                                for(j=0;j<c1;j++)
                                {
                                    ans.append(c);
                                }
                                ans.append("\n");

                            }
                        }
                        else
                        {
                            System.out.println(-1);return;
                        }
        }

        System.out.println(ans);
    }

}


import java.util.Scanner;

public class q4
{

    public static void main(String args[])
    {
        Scanner s=new Scanner(System.in);
        int x=s.nextInt();
        int y=s.nextInt();
        int a1=Math.max(x, y);
        int a2=Math.min(x, y);

         x=s.nextInt();
         y=s.nextInt();
        int b1=Math.max(x, y);
        int b2=Math.min(x, y);

         x=s.nextInt();
         y=s.nextInt();
        int c1=Math.max(x, y);
        int c2=Math.min(x, y);

        int max=Math.max(c1, Math.max(a1, b1));

        if(max==a1)
        {
            print(a1,a2,"A",b1,b2,"B",c1,c2,"C",max);
        }
        else
            if(max==b1)
            {

                print(b1,b2,"B",a1,a2,"A",c1,c2,"C",max);
            }
            else
                if(max==c1)
                {
                    print(c1,c2,"C",b1,b2,"B",a1,a2,"A",max);
                }

    }

    public static void print(int a1,int a2,String a,int b1,int b2,String b,int c1,int c2,String c,int max)
    {

        int r=a2;
        StringBuilder ans=new StringBuilder();
        ans.append(max+"\n");
        for(int i=0;i<a2;i++)
            {
            for(int j=0;j<a1;j++)
            ans.append(a);

            ans.append("\n");
            }

        if(a1==b1&& b1==c1)
        {
            for(int i=0;i<b2;i++)
            {
            for(int j=0;j<a1;j++)
            ans.append(b);

            ans.append("\n");
            }

            for(int i=0;i<c2;i++)
            {
            for(int j=0;j<a1;j++)
            ans.append(c);

            ans.append("\n");
            }
        }
        else
        {
            if(b1==c1 && b1+r==max && b2+c2==max)
            {
                for(int i=0;i<b1;i++)
                {
                    int j=0;
                    for(j=0;j<b2;j++)
                    {
                        ans.append(b);
                    }
                    for(j=0;j<c2;j++)
                    {
                        ans.append(c);
                    }
                    ans.append("\n");

                }
            }
            else
                if(b1==c2 && b1+r==max && b2+c1==max)
                {
                    for(int i=0;i<b1;i++)
                    {
                        int j=0;
                        for(j=0;j<b2;j++)
                        {
                            ans.append(b);
                        }
                        for(j=0;j<c1;j++)
                        {
                            ans.append(c);
                        }
                        ans.append("\n");

                    }
                }
                else
                    if(b2==c1 && b2+r==max && b1+c2==max)
                    {
                        for(int i=0;i<b2;i++)
                        {
                            int j=0;
                            for(j=0;j<b1;j++)
                            {
                                ans.append(b);
                            }
                            for(j=0;j<c2;j++)
                            {
                                ans.append(c);
                            }
                            ans.append("\n");

                        }
                    }
                    else
                        if(b2==c2 && b2+r==max && b1+c1==max)
                        {
                            for(int i=0;i<b2;i++)
                            {
                                int j=0;
                                for(j=0;j<b1;j++)
                                {
                                    ans.append(b);
                                }
                                for(j=0;j<c1;j++)
                                {
                                    ans.append(c);
                                }
                                ans.append("\n");

                            }
                        }
                        else
                        {
                            System.out.println(-1);return;
                        }
        }

        System.out.println(ans);
    }

}


import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.StringTokenizer;

public class A implements Runnable {

	final static boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;

	BufferedReader in;
	PrintWriter out;
	StringTokenizer tok = new StringTokenizer("");

	final static String fileName = "";

	void init() throws IOException {
		if (ONLINE_JUDGE) {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
		} else {
			if (fileName.isEmpty()) {
				in = new BufferedReader(new FileReader("input.txt"));
				out = new PrintWriter("output.txt");
			} else {
				in = new BufferedReader(new FileReader(fileName + ".in"));
				out = new PrintWriter(fileName + ".out");
			}
		}
	}

	public static void main(String[] args) {
		new A().run();
	}

	String readString() throws IOException {
		while (!tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	int readInt() throws NumberFormatException, IOException {
		return Integer.parseInt(readString());
	}

	long readLong() throws NumberFormatException, IOException {
		return Long.parseLong(readString());
	}

	int[] readIntArray(int size) throws NumberFormatException, IOException {
		int[] arr = new int[size];
		for (int i = 0; i < size; i++) {
			arr[i] = readInt();
		}
		return arr;
	}

	static long timeIn;

	void time() {
		System.err.println("Time = " + (System.currentTimeMillis() - timeIn));
	}

	public void run() {
		try {
			timeIn = System.currentTimeMillis();
			init();
			solve();
			out.close();
			time();
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(-1);
		}
	}

	boolean isFree(int i, int j, char[][] map) {
		boolean free = (i >= 0 && j >= 0 && i < map.length && j < map.length && map[i][j] == 0);
		free &= !(i - 1 >= 0 && j >= 0 && i - 1 < map.length && j < map.length && map[i - 1][j] == 0);
		free &= !(i >= 0 && j - 1 >= 0 && i < map.length && j - 1 < map.length && map[i][j - 1] == 0);
		return free;
	}

	int x1, x2, x3, y1, y2, y3;

	void addSecondRectangle(char[][] map, int x, int y, char character) {
		int n = map.length;

		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				if (isFree(i, j, map) && i + x <= n && j + y <= n) {

					char[][] newMap = new char[n][n];
					for (int ii = 0; ii < n; ii++) {
						for (int jj = 0; jj < n; jj++) {
							newMap[ii][jj] = map[ii][jj];
						}
					}

					for (int ii = i; ii < i + x; ii++) {
						for (int jj = j; jj < j + y; jj++) {
							newMap[ii][jj] = character;
						}
					}

					addThirdRectangle(newMap, x3, y3, 'C');
					addThirdRectangle(newMap, y3, x3, 'C');
				}
			}
		}
	}

	void addThirdRectangle(char[][] map, int x, int y, char character) {
		int n = map.length;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				if (isFree(i, j, map) && i + x <= n && j + y <= n) {

					char[][] newMap = new char[n][n];
					for (int ii = 0; ii < n; ii++) {
						for (int jj = 0; jj < n; jj++) {
							newMap[ii][jj] = map[ii][jj];
						}
					}

					for (int ii = i; ii < i + x; ii++) {
						for (int jj = j; jj < j + y; jj++) {
							newMap[ii][jj] = character;
						}
					}

					boolean check = true;

					for (int ii = 0; ii < n; ii++) {
						for (int jj = 0; jj < n; jj++) {
							check &= newMap[ii][jj] != 0;
						}
					}

					if (check) {
						printAns(newMap);
					}
				}
			}
		}
	}

	void printAns(char[][] map) {
		int size = map.length;
		out.println(size);
		for (int i = 0; i < map.length; i++) {
			for (int j = 0; j < map.length; j++) {
				if (map[i][j] > 0) {
					out.print(map[i][j]);
				} else {
					out.print('.');
				}
			}
			out.println();
		}
		out.close();
		System.exit(0);
	}

	private void solve() throws IllegalArgumentException, IOException {

		x1 = readInt();
		y1 = readInt();
		x2 = readInt();
		y2 = readInt();
		x3 = readInt();
		y3 = readInt();

		int size = Math.max(x1, Math.max(x2, Math.max(x3, Math.max(y1, Math.max(y2, y3)))));

		char[][] map = new char[size][size];

		for (int i = 0; i < x1; i++) {
			for (int j = 0; j < y1; j++) {
				map[i][j] = 'A';
			}
		}

		addSecondRectangle(map, x2, y2, 'B');
		addSecondRectangle(map, y2, x2, 'B');

		map = new char[size][size];
		for (int i = 0; i < y1; i++) {
			for (int j = 0; j < x1; j++) {
				map[i][j] = 'A';
			}
		}

		addSecondRectangle(map, x2, y2, 'B');
		addSecondRectangle(map, y2, x2, 'B');

		out.println(-1);
	}

}


import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class ThreeLogos {
    static char[][] res;
    static int maxW, maxH;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int c1[] = new int[2];
        c1[0] = sc.nextInt();
        c1[1] = sc.nextInt();
        int c2[] = new int[2];
        c2[0] = sc.nextInt();
        c2[1] = sc.nextInt();
        int c3[] = new int[2];
        c3[0] = sc.nextInt();
        c3[1] = sc.nextInt();
        P[] p = new P[3];
        for (int i = 0; i < 2; i++) {
            for (int j = 0; j < 2; j++) {
                for (int k = 0; k < 2; k++) {
                    p[0] = new P(c1[i], c1[1 - i], 'A');
                    p[1] = new P(c2[j], c2[1 - j], 'B');
                    p[2] = new P(c3[k], c3[1 - k], 'C');
                    if (possible(p)) {
                        print();
                        return;
                    }
                }
            }
        }
        System.out.println(-1);
    }

    private static void print() {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < res.length; i++) {
            for (int j = 0; j < res.length; j++) {
                sb.append(res[i][j]);
            }
            sb.append("\n");
        }
        System.out.print(maxH + "\n" + sb);
    }

    static class P {
        int x, y;
        char c;

        P(int i, int j, char k) {
            x = i;
            y = j;
            c = k;
        }

        public String toString() {
            return x + " " + y;
        }
    }

    static boolean possible(P[] p) {
        // x = width y = height
        Arrays.sort(p, new Comparator<P>() {
            @Override
            public int compare(P o1, P o2) {
                return -Integer.compare(o1.x, o2.x);
            }
        });
        if (p[0].x == p[1].x && p[1].x == p[2].x) {
            maxW = p[0].x;
            maxH = p[0].y + p[1].y + p[2].y;
            if (maxW == maxH) {
                res = new char[maxH][maxW];
                int stY = 0;
                int endY = p[0].y;
                fill(stY, endY, 0, maxW, p[0].c);
                stY += p[0].y;
                endY = stY + p[1].y;
                fill(stY, endY, 0, maxW, p[1].c);
                stY += p[1].y;
                endY = stY + p[2].y;
                fill(stY, endY, 0, maxW, p[2].c);
                return true;
            }
        }
        if (p[0].x == p[1].x + p[2].x && p[1].y == p[2].y) {
            maxW = p[0].x;
            maxH = p[0].y + p[1].y;
            if (maxW == maxH) {
                res = new char[maxH][maxW];
                fill(0, p[0].y, 0, maxW, p[0].c);
                fill(p[0].y, p[0].y + p[1].y, 0, p[1].x, p[1].c);
                fill(p[0].y, p[0].y + p[1].y, p[1].x, p[1].x + p[2].x, p[2].c);
                return true;
            }
        }
        return false;

    }

    private static void fill(int sy, int y, int sx, int x, char c) {
        for (int i = sy; i < y; i++) {
            for (int j = sx; j < x; j++) {
                res[i][j] = c;
            }
        }
    }
}


/*
 * Code Author: Akshay Miterani
 * DA-IICT
 */
import java.io.*;
import java.util.*;

public class MainB {

	static int end;
	static char a='A',b='B',c='C';
	public static void main(String args[]){
		InputReader in = new InputReader(System.in);
		OutputStream outputStream = System.out;
		PrintWriter out = new PrintWriter(outputStream);
		//----------My Code Starts Here----------
		int x1=in.nextInt();
		int y1=in.nextInt();
		int x2=in.nextInt();
		int y2=in.nextInt();
		int x3=in.nextInt();
		int y3=in.nextInt();
		if(chk1(x1,y1,x2,y2,x3,y3))
			return;
		if(chk1(y1,x1,x2,y2,x3,y3))
			return;
		if(chk1(x1,y1,y2,x2,x3,y3))
			return;
		if(chk1(x1,y1,x2,y2,y3,x3))
			return;
		if(chk1(y1,x1,y2,x2,y3,x3))
			return;
		if(chk1(x1,y1,y2,x2,y3,x3))
			return;
		if(chk1(y1,x1,x2,y2,y3,x3))
			return;
		if(chk1(y1,x1,y2,x2,x3,y3))
			return;

		if(chk2(x1,y1,x2,y2,x3,y3))
			return;
		if(chk2(y1,x1,x2,y2,x3,y3))
			return;
		if(chk2(x1,y1,y2,x2,x3,y3))
			return;
		if(chk2(x1,y1,x2,y2,y3,x3))
			return;
		if(chk2(y1,x1,y2,x2,y3,x3))
			return;
		if(chk2(x1,y1,y2,x2,y3,x3))
			return;
		if(chk2(y1,x1,x2,y2,y3,x3))
			return;
		if(chk2(y1,x1,y2,x2,x3,y3))
			return;

		if(chk2(x1,y1,x3,y3,x2,y2))
			return;
		if(chk2(y1,x1,x3,y3,x2,y2))
			return;
		if(chk2(x1,y1,y3,x3,x2,y2))
			return;
		if(chk2(x1,y1,x3,y3,y2,x2))
			return;
		if(chk2(y1,x1,y3,x3,y2,x2))
			return;
		if(chk2(x1,y1,y3,x3,y2,x2))
			return;
		if(chk2(y1,x1,x3,y3,y2,x2))
			return;
		if(chk2(y1,x1,y3,x3,x2,y2))
			return;

		if(chk2(x3,y3,x2,y2,x1,y1))
			return;
		if(chk2(y3,x3,x2,y2,x1,y1))
			return;
		if(chk2(x3,y3,y2,x2,x1,y1))
			return;
		if(chk2(x3,y3,x2,y2,y1,x1))
			return;
		if(chk2(y3,x3,y2,x2,y1,x1))
			return;
		if(chk2(x3,y3,y2,x2,y1,x1))
			return;
		if(chk2(y3,x3,x2,y2,y1,x1))
			return;
		if(chk2(y3,x3,y2,x2,x1,y1))
			return;

		System.out.println("-1");
		out.close();
		//---------------The End------------------
	}

	static void print(char p,int n){
		for(int i=0;i<n;i++){
			System.out.print(p);
		}
		System.out.println();
	}

	static boolean chk1(int x1,int y1,int x2,int y2,int x3,int y3){
		if(x1+x2+x3==y1 && y1==y2 && y2==y3){
			System.out.println(y1);
			int n=y1;
			for(int i=0;i<y1;i++){
				if(i<x1){
					print(a,n);
				}
				else if(i<x1+x2){
					print(b,n);
				}
				else{
					print(c,n);
				}
			}
			return true;
		}
		return false;
	}
	static boolean chk2(int x1,int y1,int x2,int y2,int x3,int y3){
		if(x1==x2 && y1+y2==x3 && x3==x1+y3){
			int n=x3;
			System.out.println(n);
			for(int i=0;i<y3;i++){
				print(b,n);
			}
			for(int i=y3;i<n;i++){
				for(int j=0;j<n;j++){
					if(j<y1){
						System.out.print(a);
					}
					else{
						System.out.print(c);
					}
				}
				System.out.println();
			}
			return true;
		}
		return false;
	}
	static class Pair implements Comparable<Pair>{
		int x;
		int y;
		Pair(int xx,int yy){
			x=xx;
			y=yy;
		}
		@Override
		public int compareTo(Pair o) {
			return Integer.compare((this.x),(o.x));
		}
	}

	static class InputReader {
	    public BufferedReader reader;
	    public StringTokenizer tokenizer;

	    public InputReader(InputStream inputstream) {
	      reader = new BufferedReader(new InputStreamReader(inputstream));
	      tokenizer = null;
	    }

	    public String nextLine(){
	    	String fullLine=null;
	    	while (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	              fullLine=reader.readLine();
	            } catch (IOException e) {
	              throw new RuntimeException(e);
	            }
	            return fullLine;
	          }
	          return fullLine;
	    }
		public String next() {
	      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
	        try {
	          tokenizer = new StringTokenizer(reader.readLine());
	        } catch (IOException e) {
	          throw new RuntimeException(e);
	        }
	      }
	      return tokenizer.nextToken();
	    }
		public long nextLong() {
		      return Long.parseLong(next());
		    }
	    public int nextInt() {
	      return Integer.parseInt(next());
	    }
	  }
}


/*
 * Code Author: Akshay Miterani
 * DA-IICT
 */
import java.io.*;
import java.util.*;

public class MainB {

	static int end;
	static char a='A',b='B',c='C';
	public static void main(String args[]){
		InputReader in = new InputReader(System.in);
		OutputStream outputStream = System.out;
		PrintWriter out = new PrintWriter(outputStream);
		//----------My Code Starts Here----------
		int x1=in.nextInt();
		int y1=in.nextInt();
		int x2=in.nextInt();
		int y2=in.nextInt();
		int x3=in.nextInt();
		int y3=in.nextInt();
		if(chk1(x1,y1,x2,y2,x3,y3))
			return;
		if(chk1(y1,x1,x2,y2,x3,y3))
			return;
		if(chk1(x1,y1,y2,x2,x3,y3))
			return;
		if(chk1(x1,y1,x2,y2,y3,x3))
			return;
		if(chk1(y1,x1,y2,x2,y3,x3))
			return;
		if(chk1(x1,y1,y2,x2,y3,x3))
			return;
		if(chk1(y1,x1,x2,y2,y3,x3))
			return;
		if(chk1(y1,x1,y2,x2,x3,y3))
			return;
		a='A';
		b='C';
		c='B';
		if(chk2(x1,y1,x2,y2,x3,y3))
			return;
		if(chk2(y1,x1,x2,y2,x3,y3))
			return;
		if(chk2(x1,y1,y2,x2,x3,y3))
			return;
		if(chk2(x1,y1,x2,y2,y3,x3))
			return;
		if(chk2(y1,x1,y2,x2,y3,x3))
			return;
		if(chk2(x1,y1,y2,x2,y3,x3))
			return;
		if(chk2(y1,x1,x2,y2,y3,x3))
			return;
		if(chk2(y1,x1,y2,x2,x3,y3))
			return;
		a='A';
		b='B';
		c='C';
		if(chk2(x1,y1,x3,y3,x2,y2))
			return;
		if(chk2(y1,x1,x3,y3,x2,y2))
			return;
		if(chk2(x1,y1,y3,x3,x2,y2))
			return;
		if(chk2(x1,y1,x3,y3,y2,x2))
			return;
		if(chk2(y1,x1,y3,x3,y2,x2))
			return;
		if(chk2(x1,y1,y3,x3,y2,x2))
			return;
		if(chk2(y1,x1,x3,y3,y2,x2))
			return;
		if(chk2(y1,x1,y3,x3,x2,y2))
			return;
		a='C';
		b='A';
		c='B';
		if(chk2(x3,y3,x2,y2,x1,y1))
			return;
		if(chk2(y3,x3,x2,y2,x1,y1))
			return;
		if(chk2(x3,y3,y2,x2,x1,y1))
			return;
		if(chk2(x3,y3,x2,y2,y1,x1))
			return;
		if(chk2(y3,x3,y2,x2,y1,x1))
			return;
		if(chk2(x3,y3,y2,x2,y1,x1))
			return;
		if(chk2(y3,x3,x2,y2,y1,x1))
			return;
		if(chk2(y3,x3,y2,x2,x1,y1))
			return;

		System.out.println("-1");
		out.close();
		//---------------The End------------------
	}

	static void print(char p,int n){
		for(int i=0;i<n;i++){
			System.out.print(p);
		}
		System.out.println();
	}

	static boolean chk1(int x1,int y1,int x2,int y2,int x3,int y3){
		if(x1+x2+x3==y1 && y1==y2 && y2==y3){
			System.out.println(y1);
			int n=y1;
			for(int i=0;i<y1;i++){
				if(i<x1){
					print(a,n);
				}
				else if(i<x1+x2){
					print(b,n);
				}
				else{
					print(c,n);
				}
			}
			return true;
		}
		return false;
	}
	static boolean chk2(int x1,int y1,int x2,int y2,int x3,int y3){
		if(x1==x2 && y1+y2==x3 && x3==x1+y3){
			int n=x3;
			System.out.println(n);
			for(int i=0;i<y3;i++){
				print(b,n);
			}
			for(int i=y3;i<n;i++){
				for(int j=0;j<n;j++){
					if(j<y1){
						System.out.print(a);
					}
					else{
						System.out.print(c);
					}
				}
				System.out.println();
			}
			return true;
		}
		return false;
	}
	static class Pair implements Comparable<Pair>{
		int x;
		int y;
		Pair(int xx,int yy){
			x=xx;
			y=yy;
		}
		@Override
		public int compareTo(Pair o) {
			return Integer.compare((this.x),(o.x));
		}
	}

	static class InputReader {
	    public BufferedReader reader;
	    public StringTokenizer tokenizer;

	    public InputReader(InputStream inputstream) {
	      reader = new BufferedReader(new InputStreamReader(inputstream));
	      tokenizer = null;
	    }

	    public String nextLine(){
	    	String fullLine=null;
	    	while (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	              fullLine=reader.readLine();
	            } catch (IOException e) {
	              throw new RuntimeException(e);
	            }
	            return fullLine;
	          }
	          return fullLine;
	    }
		public String next() {
	      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
	        try {
	          tokenizer = new StringTokenizer(reader.readLine());
	        } catch (IOException e) {
	          throw new RuntimeException(e);
	        }
	      }
	      return tokenizer.nextToken();
	    }
		public long nextLong() {
		      return Long.parseLong(next());
		    }
	    public int nextInt() {
	      return Integer.parseInt(next());
	    }
	  }
}


/*
 * Code Author: Akshay Miterani
 * DA-IICT
 */
import java.io.*;
import java.util.*;

public class MainB {

	static int end;
	static char a='A',b='B',c='C';
	public static void main(String args[]){
		InputReader in = new InputReader(System.in);
		OutputStream outputStream = System.out;
		PrintWriter out = new PrintWriter(outputStream);
		//----------My Code Starts Here----------
		int x1=in.nextInt();
		int y1=in.nextInt();
		int x2=in.nextInt();
		int y2=in.nextInt();
		int x3=in.nextInt();
		int y3=in.nextInt();
		if(chk1(x1,y1,x2,y2,x3,y3))
			return;
		if(chk1(y1,x1,x2,y2,x3,y3))
			return;
		if(chk1(x1,y1,y2,x2,x3,y3))
			return;
		if(chk1(x1,y1,x2,y2,y3,x3))
			return;
		if(chk1(y1,x1,y2,x2,y3,x3))
			return;
		if(chk1(x1,y1,y2,x2,y3,x3))
			return;
		if(chk1(y1,x1,x2,y2,y3,x3))
			return;
		if(chk1(y1,x1,y2,x2,x3,y3))
			return;

		if(chk2(x1,y1,x2,y2,x3,y3))
			return;
		if(chk2(y1,x1,x2,y2,x3,y3))
			return;
		if(chk2(x1,y1,y2,x2,x3,y3))
			return;
		if(chk2(x1,y1,x2,y2,y3,x3))
			return;
		if(chk2(y1,x1,y2,x2,y3,x3))
			return;
		if(chk2(x1,y1,y2,x2,y3,x3))
			return;
		if(chk2(y1,x1,x2,y2,y3,x3))
			return;
		if(chk2(y1,x1,y2,x2,x3,y3))
			return;

		if(chk2(x1,y1,x3,y3,x2,y2))
			return;
		if(chk2(y1,x1,x3,y3,x2,y2))
			return;
		if(chk2(x1,y1,y3,x3,x2,y2))
			return;
		if(chk2(x1,y1,x3,y3,y2,x2))
			return;
		if(chk2(y1,x1,y3,x3,y2,x2))
			return;
		if(chk2(x1,y1,y3,x3,y2,x2))
			return;
		if(chk2(y1,x1,x3,y3,y2,x2))
			return;
		if(chk2(y1,x1,y3,x3,x2,y2))
			return;
		System.out.println("-1");
		out.close();
		//---------------The End------------------
	}

	static void print(char p,int n){
		for(int i=0;i<n;i++){
			System.out.print(p);
		}
		System.out.println();
	}

	static boolean chk1(int x1,int y1,int x2,int y2,int x3,int y3){
		if(x1+x2+x3==y1 && y1==y2 && y2==y3){
			System.out.println(y1);
			int n=y1;
			for(int i=0;i<y1;i++){
				if(i<x1){
					print(a,n);
				}
				else if(i<x1+x2){
					print(b,n);
				}
				else{
					print(c,n);
				}
			}
			return true;
		}
		return false;
	}
	static boolean chk2(int x1,int y1,int x2,int y2,int x3,int y3){
		if(x1==x2 && y1+y2==x3 && x3==x1+y3){
			int n=x3;
			for(int i=0;i<y3;i++){
				print(b,n);
			}
			for(int i=y3;i<n;i++){
				for(int j=0;j<n;j++){
					if(j<y1){
						System.out.print(a);
					}
					else{
						System.out.print(c);
					}
				}
				System.out.println();
			}
			return true;
		}
		return false;
	}
	static class Pair implements Comparable<Pair>{
		int x;
		int y;
		Pair(int xx,int yy){
			x=xx;
			y=yy;
		}
		@Override
		public int compareTo(Pair o) {
			return Integer.compare((this.x),(o.x));
		}
	}

	static class InputReader {
	    public BufferedReader reader;
	    public StringTokenizer tokenizer;

	    public InputReader(InputStream inputstream) {
	      reader = new BufferedReader(new InputStreamReader(inputstream));
	      tokenizer = null;
	    }

	    public String nextLine(){
	    	String fullLine=null;
	    	while (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	              fullLine=reader.readLine();
	            } catch (IOException e) {
	              throw new RuntimeException(e);
	            }
	            return fullLine;
	          }
	          return fullLine;
	    }
		public String next() {
	      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
	        try {
	          tokenizer = new StringTokenizer(reader.readLine());
	        } catch (IOException e) {
	          throw new RuntimeException(e);
	        }
	      }
	      return tokenizer.nextToken();
	    }
		public long nextLong() {
		      return Long.parseLong(next());
		    }
	    public int nextInt() {
	      return Integer.parseInt(next());
	    }
	  }
}


/*
 * Code Author: Akshay Miterani
 * DA-IICT
 */
import java.io.*;
import java.util.*;

public class MainB {

	static int end;
	static char a='A',b='B',c='C';
	public static void main(String args[]){
		InputReader in = new InputReader(System.in);
		OutputStream outputStream = System.out;
		PrintWriter out = new PrintWriter(outputStream);
		//----------My Code Starts Here----------
		int x1=in.nextInt();
		int y1=in.nextInt();
		int x2=in.nextInt();
		int y2=in.nextInt();
		int x3=in.nextInt();
		int y3=in.nextInt();
		if(chk1(x1,y1,x2,y2,x3,y3))
			return;
		if(chk1(y1,x1,x2,y2,x3,y3))
			return;
		if(chk1(x1,y1,y2,x2,x3,y3))
			return;
		if(chk1(x1,y1,x2,y2,y3,x3))
			return;
		if(chk1(y1,x1,y2,x2,y3,x3))
			return;
		if(chk1(x1,y1,y2,x2,y3,x3))
			return;
		if(chk1(y1,x1,x2,y2,y3,x3))
			return;
		if(chk1(y1,x1,y2,x2,x3,y3))
			return;

		if(chk2(x1,y1,x2,y2,x3,y3))
			return;
		if(chk2(y1,x1,x2,y2,x3,y3))
			return;
		if(chk2(x1,y1,y2,x2,x3,y3))
			return;
		if(chk2(x1,y1,x2,y2,y3,x3))
			return;
		if(chk2(y1,x1,y2,x2,y3,x3))
			return;
		if(chk2(x1,y1,y2,x2,y3,x3))
			return;
		if(chk2(y1,x1,x2,y2,y3,x3))
			return;
		if(chk2(y1,x1,y2,x2,x3,y3))
			return;

		if(chk2(x1,y1,x3,y3,x2,y2))
			return;
		if(chk2(y1,x1,x3,y3,x2,y2))
			return;
		if(chk2(x1,y1,y3,x3,x2,y2))
			return;
		if(chk2(x1,y1,x3,y3,y2,x2))
			return;
		if(chk2(y1,x1,y3,x3,y2,x2))
			return;
		if(chk2(x1,y1,y3,x3,y2,x2))
			return;
		if(chk2(y1,x1,x3,y3,y2,x2))
			return;
		if(chk2(y1,x1,y3,x3,x2,y2))
			return;
		System.out.println("-1");
		out.close();
		//---------------The End------------------
	}

	static void print(char p,int n){
		for(int i=0;i<n;i++){
			System.out.print(p);
		}
		System.out.println();
	}

	static boolean chk1(int x1,int y1,int x2,int y2,int x3,int y3){
		if(x1+x2+x3==y1 && y1==y2 && y2==y3){
			System.out.println(y1);
			int n=y1;
			for(int i=0;i<y1;i++){
				if(i<x1){
					print(a,n);
				}
				else if(i<x1+x2){
					print(b,n);
				}
				else{
					print(c,n);
				}
			}
			return true;
		}
		return false;
	}
	static boolean chk2(int x1,int y1,int x2,int y2,int x3,int y3){
		if(x1==x2 && y1+y2==x3 && x3==x1+y3){
			int n=x3;
			System.out.println(n);
			for(int i=0;i<y3;i++){
				print(b,n);
			}
			for(int i=y3;i<n;i++){
				for(int j=0;j<n;j++){
					if(j<y1){
						System.out.print(a);
					}
					else{
						System.out.print(c);
					}
				}
				System.out.println();
			}
			return true;
		}
		return false;
	}
	static class Pair implements Comparable<Pair>{
		int x;
		int y;
		Pair(int xx,int yy){
			x=xx;
			y=yy;
		}
		@Override
		public int compareTo(Pair o) {
			return Integer.compare((this.x),(o.x));
		}
	}

	static class InputReader {
	    public BufferedReader reader;
	    public StringTokenizer tokenizer;

	    public InputReader(InputStream inputstream) {
	      reader = new BufferedReader(new InputStreamReader(inputstream));
	      tokenizer = null;
	    }

	    public String nextLine(){
	    	String fullLine=null;
	    	while (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	              fullLine=reader.readLine();
	            } catch (IOException e) {
	              throw new RuntimeException(e);
	            }
	            return fullLine;
	          }
	          return fullLine;
	    }
		public String next() {
	      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
	        try {
	          tokenizer = new StringTokenizer(reader.readLine());
	        } catch (IOException e) {
	          throw new RuntimeException(e);
	        }
	      }
	      return tokenizer.nextToken();
	    }
		public long nextLong() {
		      return Long.parseLong(next());
		    }
	    public int nextInt() {
	      return Integer.parseInt(next());
	    }
	  }
}


import java.util.Scanner;

public class d {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int w1 = sc.nextInt();
		int h1 = sc.nextInt();
		int w2 = sc.nextInt();
		int h2 = sc.nextInt();
		int w3 = sc.nextInt();
		int h3 = sc.nextInt();

		if (works(w1,h1,w2,h2,w3,h3)) {

		}
		else if (works(w1,h1,w2,h2,h3,w3)) {

		}
		else if (works(w1,h1,h2,w2,w3,h3)) {

		}
		else if (works(w1,h1,h2,w2,h3,w3)){

		}
		else if (works(h1,w1,w2,h2,w3,h3)) {

		}
		else if (works(h1,w1,w2,h2,h3,w3)) {

		}
		else if (works(h1,w1,h2,w2,w3,h3)) {

		}
		else if (works(h1,w1,h2,w2,h3,w3)) {

		}
		else {
			System.out.println(-1);
		}

	}

	static boolean works(int w1, int h1, int w2, int h2, int w3, int h3) {
		if (w1==w2 && w1==w3) {
			System.out.println(w1);
			for (int i = 0; i < h1 +h2 + h3; i++) {
				for (int j = 0; j < w1; j++) {
					if (i<h1) {
						System.out.print("A");
					}
					else if (i < h2) {
						System.out.print("B");
					}
					else {
						System.out.print("C");
					}
				}
				System.out.println();
			}
			return true;
		}
		else if (h1==h2 && h1==h3) {
			System.out.println(w1+w2+w3);
			for (int i = 0; i < h1; i++) {
				for (int j = 0; j < w1+w2+w3; j++) {
					if (j<w1) {
						System.out.print("A");
					}
					else if (j < w2) {
						System.out.print("B");
					}
					else {
						System.out.print("C");
					}
				}
				System.out.println();
			}
			return true;
		}
		else {
			// Check if widths add
			if (w1==w2+w3 && h2==h3) {
				System.out.println(w1);
				for (int i = 0; i < h1+h2; i++) {
					for (int j = 0; j < w1; j++) {
						if (i<h1) {
							System.out.print("A");
						}
						else {
							if (j<w2) {
								System.out.print("B");
							}
							else {
								System.out.print("C");
							}
						}
					}
					System.out.println();
				}
				return true;
			}
			else if (w2==w1+w3 && h1==h3) {
				System.out.println(w2);
				for (int i = 0; i < h1+h2; i++) {
					for (int j = 0; j < w2; j++) {
						if (i<h2) {
							System.out.print("B");
						}
						else {
							if (j<w1) {
								System.out.print("A");
							}
							else {
								System.out.print("C");
							}
						}
					}
					System.out.println();
				}
				return true;
			}
			else if (w3==w1+w2 && h1==h2) {
				System.out.println(w3);
				for (int i = 0; i < h1+h3; i++) {
					for (int j = 0; j < w3; j++) {
						if (i<h3) {
							System.out.print("C");
						}
						else {
							if (j<w1) {
								System.out.print("A");
							}
							else {
								System.out.print("B");
							}
						}
					}
					System.out.println();
				}
				return true;
			}
			// Check if heights add
			else if(h1==h2+h3 && w2==w3) {
				System.out.println(w1+w2);
				for (int i = 0; i < h1; i++) {
					for (int j = 0; j < w1+w2; j++) {
						if (j < w1) {
							System.out.print("A");
						}
						else {
							if (i<h2) {
								System.out.print("B");
							}
							else {
								System.out.print("C");
							}
						}
					}
					System.out.println();
				}
				return true;
			}
			else if (h2==h1+h3 && w1==w3) {
				System.out.println(w1+w2);
				for (int i = 0; i < h2; i++) {
					for (int j = 0; j < w1+w2; j++) {
						if (j < w2) {
							System.out.print("B");
						}
						else {
							if (i<h1) {
								System.out.print("A");
							}
							else {
								System.out.print("C");
							}
						}
					}
					System.out.println();
				}
				return true;
			}
			else if (h3==h1+h2 && w1==w2) {
				System.out.println(w1+w3);
				for (int i = 0; i < h3; i++) {
					for (int j = 0; j < w1+w3; j++) {
						if (j < w3) {
							System.out.print("C");
						}
						else {
							if (i<h1) {
								System.out.print("A");
							}
							else {
								System.out.print("B");
							}
						}
					}
					System.out.println();
				}
				return true;
			}
			// Otherwise it doesn't work
			else {
				return false;
			}
		}
	}

}


import java.util.Scanner;

public class d {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int w1 = sc.nextInt();
		int h1 = sc.nextInt();
		int w2 = sc.nextInt();
		int h2 = sc.nextInt();
		int w3 = sc.nextInt();
		int h3 = sc.nextInt();

		if (works(w1,h1,w2,h2,w3,h3)) {

		}
		else if (works(w1,h1,w2,h2,h3,w3)) {

		}
		else if (works(w1,h1,h2,w2,w3,h3)) {

		}
		else if (works(w1,h1,h2,w2,h3,w3)){

		}
		else if (works(h1,w1,w2,h2,w3,h3)) {

		}
		else if (works(h1,w1,w2,h2,h3,w3)) {

		}
		else if (works(h1,w1,h2,w2,w3,h3)) {

		}
		else if (works(h1,w1,h2,w2,h3,w3)) {

		}
		else {
			System.out.println(-1);
		}

	}

	static boolean works(int w1, int h1, int w2, int h2, int w3, int h3) {
		if (w1==w2 && w1==w3) {
			System.out.println(w1);
			for (int i = 0; i < h1 +h2 + h3; i++) {
				for (int j = 0; j < w1; j++) {
					if (i<h1) {
						System.out.print("A");
					}
					else if (i < h2+h1) {
						System.out.print("B");
					}
					else {
						System.out.print("C");
					}
				}
				System.out.println();
			}
			return true;
		}
		else if (h1==h2 && h1==h3) {
			System.out.println(w1+w2+w3);
			for (int i = 0; i < h1; i++) {
				for (int j = 0; j < w1+w2+w3; j++) {
					if (j<w1) {
						System.out.print("A");
					}
					else if (j < w2+w1) {
						System.out.print("B");
					}
					else {
						System.out.print("C");
					}
				}
				System.out.println();
			}
			return true;
		}
		else {
			// Check if widths add
			if (w1==w2+w3 && h2==h3) {
				System.out.println(w1);
				for (int i = 0; i < h1+h2; i++) {
					for (int j = 0; j < w1; j++) {
						if (i<h1) {
							System.out.print("A");
						}
						else {
							if (j<w2) {
								System.out.print("B");
							}
							else {
								System.out.print("C");
							}
						}
					}
					System.out.println();
				}
				return true;
			}
			else if (w2==w1+w3 && h1==h3) {
				System.out.println(w2);
				for (int i = 0; i < h1+h2; i++) {
					for (int j = 0; j < w2; j++) {
						if (i<h2) {
							System.out.print("B");
						}
						else {
							if (j<w1) {
								System.out.print("A");
							}
							else {
								System.out.print("C");
							}
						}
					}
					System.out.println();
				}
				return true;
			}
			else if (w3==w1+w2 && h1==h2) {
				System.out.println(w3);
				for (int i = 0; i < h1+h3; i++) {
					for (int j = 0; j < w3; j++) {
						if (i<h3) {
							System.out.print("C");
						}
						else {
							if (j<w1) {
								System.out.print("A");
							}
							else {
								System.out.print("B");
							}
						}
					}
					System.out.println();
				}
				return true;
			}
			// Check if heights add
			else if(h1==h2+h3 && w2==w3) {
				System.out.println(w1+w2);
				for (int i = 0; i < h1; i++) {
					for (int j = 0; j < w1+w2; j++) {
						if (j < w1) {
							System.out.print("A");
						}
						else {
							if (i<h2) {
								System.out.print("B");
							}
							else {
								System.out.print("C");
							}
						}
					}
					System.out.println();
				}
				return true;
			}
			else if (h2==h1+h3 && w1==w3) {
				System.out.println(w1+w2);
				for (int i = 0; i < h2; i++) {
					for (int j = 0; j < w1+w2; j++) {
						if (j < w2) {
							System.out.print("B");
						}
						else {
							if (i<h1) {
								System.out.print("A");
							}
							else {
								System.out.print("C");
							}
						}
					}
					System.out.println();
				}
				return true;
			}
			else if (h3==h1+h2 && w1==w2) {
				System.out.println(w1+w3);
				for (int i = 0; i < h3; i++) {
					for (int j = 0; j < w1+w3; j++) {
						if (j < w3) {
							System.out.print("C");
						}
						else {
							if (i<h1) {
								System.out.print("A");
							}
							else {
								System.out.print("B");
							}
						}
					}
					System.out.println();
				}
				return true;
			}
			// Otherwise it doesn't work
			else {
				return false;
			}
		}
	}

}


import java.util.Scanner;

public class d {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int w1 = sc.nextInt();
		int h1 = sc.nextInt();
		int w2 = sc.nextInt();
		int h2 = sc.nextInt();
		int w3 = sc.nextInt();
		int h3 = sc.nextInt();

		if (works(w1,h1,w2,h2,w3,h3)) {

		}
		else if (works(w1,h1,w2,h2,h3,w3)) {

		}
		else if (works(w1,h1,h2,w2,w3,h3)) {

		}
		else if (works(w1,h1,h2,w2,h3,w3)){

		}
		else if (works(h1,w1,w2,h2,w3,h3)) {

		}
		else if (works(h1,w1,w2,h2,h3,w3)) {

		}
		else if (works(h1,w1,h2,w2,w3,h3)) {

		}
		else if (works(h1,w1,h2,w2,h3,w3)) {

		}
		else {
			System.out.println(-1);
		}

	}

	static boolean works(int w1, int h1, int w2, int h2, int w3, int h3) {
		if (w1==w2 && w1==w3 && h1+h2+h3==w1) {
			System.out.println(w1);
			for (int i = 0; i < h1 +h2 + h3; i++) {
				for (int j = 0; j < w1; j++) {
					if (i<h1) {
						System.out.print("A");
					}
					else if (i < h2+h1) {
						System.out.print("B");
					}
					else {
						System.out.print("C");
					}
				}
				System.out.println();
			}
			return true;
		}
		else if (h1==h2 && h1==h3 && w1+w2+w3==h1) {
			System.out.println(w1+w2+w3);
			for (int i = 0; i < h1; i++) {
				for (int j = 0; j < w1+w2+w3; j++) {
					if (j<w1) {
						System.out.print("A");
					}
					else if (j < w2+w1) {
						System.out.print("B");
					}
					else {
						System.out.print("C");
					}
				}
				System.out.println();
			}
			return true;
		}
		else {
			// Check if widths add
			if (w1==w2+w3 && h2==h3 && h1+h2==w1) {
				System.out.println(w1);
				for (int i = 0; i < h1+h2; i++) {
					for (int j = 0; j < w1; j++) {
						if (i<h1) {
							System.out.print("A");
						}
						else {
							if (j<w2) {
								System.out.print("B");
							}
							else {
								System.out.print("C");
							}
						}
					}
					System.out.println();
				}
				return true;
			}
			else if (w2==w1+w3 && h1==h3 && h1+h2==w2) {
				System.out.println(w2);
				for (int i = 0; i < h1+h2; i++) {
					for (int j = 0; j < w2; j++) {
						if (i<h2) {
							System.out.print("B");
						}
						else {
							if (j<w1) {
								System.out.print("A");
							}
							else {
								System.out.print("C");
							}
						}
					}
					System.out.println();
				}
				return true;
			}
			else if (w3==w1+w2 && h1==h2 && h1+h3==w3) {
				System.out.println(w3);
				for (int i = 0; i < h1+h3; i++) {
					for (int j = 0; j < w3; j++) {
						if (i<h3) {
							System.out.print("C");
						}
						else {
							if (j<w1) {
								System.out.print("A");
							}
							else {
								System.out.print("B");
							}
						}
					}
					System.out.println();
				}
				return true;
			}
			// Check if heights add
			else if(h1==h2+h3 && w2==w3 && w1+w2==h1) {
				System.out.println(w1+w2);
				for (int i = 0; i < h1; i++) {
					for (int j = 0; j < w1+w2; j++) {
						if (j < w1) {
							System.out.print("A");
						}
						else {
							if (i<h2) {
								System.out.print("B");
							}
							else {
								System.out.print("C");
							}
						}
					}
					System.out.println();
				}
				return true;
			}
			else if (h2==h1+h3 && w1==w3 && w1+w2==h2) {
				System.out.println(w1+w2);
				for (int i = 0; i < h2; i++) {
					for (int j = 0; j < w1+w2; j++) {
						if (j < w2) {
							System.out.print("B");
						}
						else {
							if (i<h1) {
								System.out.print("A");
							}
							else {
								System.out.print("C");
							}
						}
					}
					System.out.println();
				}
				return true;
			}
			else if (h3==h1+h2 && w1==w2 && w1+w3==h3) {
				System.out.println(w1+w3);
				for (int i = 0; i < h3; i++) {
					for (int j = 0; j < w1+w3; j++) {
						if (j < w3) {
							System.out.print("C");
						}
						else {
							if (i<h1) {
								System.out.print("A");
							}
							else {
								System.out.print("B");
							}
						}
					}
					System.out.println();
				}
				return true;
			}
			// Otherwise it doesn't work
			else {
				return false;
			}
		}
	}

}


import java.io.*;
import java.util.*;

public class Codeforces {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer token;
        token = new StringTokenizer(br.readLine());
        int x1, x2, x3, y1, y2, y3;
        x1 = Integer.parseInt(token.nextToken());
        y1 = Integer.parseInt(token.nextToken());
        x2 = Integer.parseInt(token.nextToken());
        y2 = Integer.parseInt(token.nextToken());
        x3 = Integer.parseInt(token.nextToken());
        y3 = Integer.parseInt(token.nextToken());
        int area = x1 * y1 + x2 * y2 + x3 * y3;
        int[] A, B, C;
        A = new int[2];
        B = new int[2];
        C = new int[2];
        int s = (int) Math.sqrt(area);
        int h;
        if (s * s != area) {
            System.out.println(-1);
        } else {
            // first case they are all aligned
            // A: flag1 , B: flag2, C: flag3
            A[0] = x1;
            A[1] = y1;
            B[0] = x2;
            B[1] = y2;
            C[0] = x3;
            C[1] = y3;
            for (int i = 0; i < 2; i++) {
                for (int j = 0; j < 2; j++) {
                    for (int k = 0; k < 2; k++) {
                        if ((A[i] + B[j] + C[k]) == s && A[1 - i] == B[1 - j]
                                && B[1 - j] == C[1 - k] && B[1 - j] == s) {
                            // then ok, need to print
                            h = A[1 - i];
                            System.out.println(h);
                            for (int ii = 0; ii < h; ii++) {
                                for (int jj = 0; jj < A[i]; jj++) {
                                    System.out.print('A');
                                }
                                for (int jj = 0; jj < B[j]; jj++) {
                                    System.out.print('B');
                                }
                                for (int jj = 0; jj < C[k]; jj++) {
                                    System.out.print('C');
                                }
                                System.out.println();
                            }
                            return;

                        } else if (s == (B[j] + C[k]) && (B[1 - j] == C[1 - k]) &&
                                s == (A[1 - i] + B[1 - j]) && A[i] == s) // if A widthwise
                        {
                            System.out.println(A[i]);
                            for (int ii = 0; ii < A[1 - i]; i++) {
                                for (int jj = 0; jj < A[i]; jj++) {
                                    System.out.print('A');
                                }
                                System.out.println();
                            }
                            h = B[1 - j];
                            for (int ii = 0; ii < h; ii++) {
                                for (int jj = 0; jj < B[j]; jj++) {
                                    System.out.print('B');
                                }

                                for (int jj = 0; jj < C[k]; jj++) {
                                    System.out.print('C');
                                }
                                System.out.println();
                            }
                            return;
                        } else if (s == (A[i] + C[k]) && (A[1 - i] == C[1 - k]) &&
                                s == (B[1 - j] + A[1 - i]) && B[j] == s) // if B
                        {
                            System.out.println(B[i]);
                            for (int ii = 0; ii < B[1 - j]; ii++) {
                                for (int jj = 0; jj < B[j]; jj++) {
                                    System.out.print('B');
                                }
                                System.out.println();
                            }
                            h = A[1 - i];
                            for (int ii = 0; ii < h; ii++) {
                                for (int jj = 0; jj < A[i]; jj++) {
                                    System.out.print('A');
                                }

                                for (int jj = 0; jj < C[k]; jj++) {
                                    System.out.print('C');
                                }
                                System.out.println();
                            }
                            return;
                        } else if (s == (B[j] + A[i]) && (B[1 - j] == A[1 - i]) &&
                                s == (C[1 - k] + B[1 - j]) && C[k] == s) // if C
                        {
                            System.out.println(C[k]);
                            for (int ii = 0; ii < C[1 - k]; ii++) {
                                for (int jj = 0; jj < C[k]; jj++) {
                                    System.out.print('C');
                                }
                                System.out.println();
                            }
                            h = B[1 - j];
                            for (int ii = 0; ii < h; i++) {
                                for (int jj = 0; jj < B[j]; jj++) {
                                    System.out.print('B');
                                }

                                for (int jj = 0; jj < A[i]; jj++) {
                                    System.out.print('A');
                                }
                                System.out.println();
                            }
                            return;
                        }
                    }
                }
            }
            System.out.println(-1);
        }
    }
}