/******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};

/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {

/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId])
/******/ 			return installedModules[moduleId].exports;

/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			exports: {},
/******/ 			id: moduleId,
/******/ 			loaded: false
/******/ 		};

/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);

/******/ 		// Flag the module as loaded
/******/ 		module.loaded = true;

/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}

/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;

/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;

/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";

/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {

	var List = __webpack_require__(1);
	var xy = List.map(parseInt, readline().split(' '));
	var Rect = (function () {
	    function Rect(width, height, label) {
	        this.width = width;
	        this.height = height;
	        this.label = label;
	    }
	    Rect.prototype.rotated = function () {
	        return new Rect(this.height, this.width, this.label);
	    };
	    return Rect;
	})();
	var rects = [];
	var label = ["A", "B", "C"];
	for (var i = 0; i < 3; i++) {
	    rects.push(new Rect(xy[2 * i], xy[2 * i + 1], label[i]));
	}
	var infinity = 100000000;
	function square(n) {
	    return List.map(function (_) { return List.replicate(n, "."); }, List.replicate(n, []));
	}
	function draw(canvas, x, y, r) {
	    for (var i = x; i < x + r.width; i++) {
	        for (var j = y; j < y + r.height; j++) {
	            canvas[i][j] = r.label;
	        }
	    }
	}
	function output(canvas) {
	    print(List.map(function (s) { return s.join(""); }, canvas).join("\n"));
	}
	function fit(rect) {
	    var width = rect[0].width;
	    var height = rect[0].height;
	    if (rects[1].width > width)
	        return false;
	    height += rect[1].height;
	    if (rect[2].width + rect[1].width === width) {
	        if (rect[2].height !== rect[1].height)
	            return false;
	        if (height !== width)
	            return false;
	        var canvas = square(width);
	        draw(canvas, 0, 0, rect[0]);
	        draw(canvas, 0, rect[0].height, rect[1]);
	        draw(canvas, rect[1].width, rect[0].height, rect[2]);
	        output(canvas);
	        return true;
	    }
	    else {
	        if (rect[1].width != width || rect[2].width != width)
	            return false;
	        height += rect[2].height;
	        if (height != width)
	            return false;
	        var canvas = square(width);
	        draw(canvas, 0, 0, rect[0]);
	        draw(canvas, 0, rect[0].height, rect[1]);
	        draw(canvas, 0, rect[0].height + rect[1].height, rect[2]);
	        output(canvas);
	        return true;
	    }
	}
	var found = false;
	for (var rotation = 0; rotation < 8 && !found; rotation++) {
	    var rotated = [];
	    for (var i = 0; i < 3; i++) {
	        var should_rotate = ((rotation >> i) & 1) !== 0;
	        rotated.push(should_rotate ? rects[i].rotated() : rects[i]);
	    }
	    var p = List.range(0, 2);
	    do {
	        found = found || fit(List.apply_permutation(p, rotated));
	    } while ((p = List.next_permutation(p)) && !found);
	}
	if (!found)
	    print("-1");

/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {

	var Prelude_1 = __webpack_require__(2);
	function add(xs, ys) {
	    return xs.concat(ys);
	}
	exports.add = add;
	function head(xs) {
	    return xs[0];
	}
	exports.head = head;
	function last(xs) {
	    return xs[xs.length - 1];
	}
	exports.last = last;
	function tail(xs) {
	    return xs.slice(1);
	}
	exports.tail = tail;
	function init(xs) {
	    return xs.slice(0, xs.length - 1);
	}
	exports.init = init;
	function map(f, xs) {
	    var result = new Array(xs.length);
	    for (var i = 0; i < xs.length; i++) {
	        result[i] = f(xs[i]);
	    }
	    return result;
	}
	exports.map = map;
	function reverse(xs) {
	    return xs.slice().reverse();
	}
	exports.reverse = reverse;
	function intersperse(x, xs) {
	    if (xs.length == 0) {
	        return [];
	    }
	    var result = new Array(xs.length + xs.length - 1);
	    for (var i = 0; i + 1 < xs.length; i++) {
	        result[i + i] = xs[i];
	        result[i + i + 1] = x;
	    }
	    result[result.length - 1] = xs[xs.length - 1];
	    return result;
	}
	exports.intersperse = intersperse;
	function intercalate(xs, xss) {
	    return concat(intersperse(xs, xss));
	}
	exports.intercalate = intercalate;
	function foldl(f, initial, xs) {
	    var result = initial;
	    for (var i = 0; i < xs.length; i++) {
	        result = f(result, xs[i]);
	    }
	    return result;
	}
	exports.foldl = foldl;
	function foldr(f, initial, xs) {
	    var result = initial;
	    for (var i = xs.length - 1; i >= 0; i--) {
	        result = f(xs[i], result);
	    }
	    return result;
	}
	exports.foldr = foldr;
	function concat(xss) {
	    var total = sum(map(function (xs) { return xs.length; }, xss));
	    var result = new Array(total);
	    var m = 0;
	    for (var i = 0; i < xss.length; i++) {
	        var xs = xss[i];
	        for (var j = 0; j < xs.length; j++) {
	            result[m++] = xs[j];
	        }
	    }
	    return result;
	}
	exports.concat = concat;
	function sum(xs) {
	    var result = 0;
	    for (var i = 0; i < xs.length; i++) {
	        result += xs[i];
	    }
	    return result;
	}
	exports.sum = sum;
	function product(xs) {
	    var result = 1;
	    for (var i = 0; i < xs.length; i++) {
	        result *= xs[i];
	    }
	    return result;
	}
	exports.product = product;
	function maximum(xs) {
	    var result = xs[0];
	    for (var i = 1; i < xs.length; i++) {
	        if (result < xs[i])
	            result = xs[i];
	    }
	    return result;
	}
	exports.maximum = maximum;
	function minimum(xs) {
	    var result = xs[0];
	    for (var i = 1; i < xs.length; i++) {
	        if (result > xs[i])
	            result = xs[i];
	    }
	    return result;
	}
	exports.minimum = minimum;
	function replicate(n, x) {
	    var result = new Array(n);
	    for (var i = 0; i < result.length; i++) {
	        result[i] = x;
	    }
	    return result;
	}
	exports.replicate = replicate;
	function take(n, xs) {
	    return xs.slice(0, n);
	}
	exports.take = take;
	function drop(n, xs) {
	    return xs.slice(n);
	}
	exports.drop = drop;
	function splitAt(n, xs) {
	    return [take(n, xs), drop(n, xs)];
	}
	exports.splitAt = splitAt;
	function takeWhile(f, xs) {
	    for (var i = 0; i < xs.length; i++) {
	        if (!f(xs[i])) {
	            return xs.slice(0, i);
	        }
	    }
	    return xs.slice();
	}
	exports.takeWhile = takeWhile;
	function dropWhile(f, xs) {
	    for (var i = 0; i < xs.length; i++) {
	        if (!f(xs[i])) {
	            return xs.slice(i);
	        }
	    }
	    return [];
	}
	exports.dropWhile = dropWhile;
	function group(xs) {
	    if (xs.length == 0) {
	        return [];
	    }
	    var result = [];
	    var last = [xs[0]];
	    for (var i = 1; i < xs.length; i++) {
	        if (last[0] === xs[i]) {
	            last.push(xs[i]);
	        }
	        else {
	            result.push(last);
	            last = [xs[i]];
	        }
	    }
	    result.push(last);
	    return result;
	}
	exports.group = group;
	function filter(f, xs) {
	    var result = [];
	    for (var i = 0; i < xs.length; i++) {
	        if (f(xs[i]))
	            result.push(xs[i]);
	    }
	    return result;
	}
	exports.filter = filter;
	function zip(xs, ys) {
	    var n = Prelude_1.min(xs.length, ys.length);
	    var result = new Array(n);
	    for (var i = 0; i < n; i++) {
	        result[i] = [xs[i], ys[i]];
	    }
	    return result;
	}
	exports.zip = zip;
	function unzip(xs) {
	    var r1 = new Array(xs.length);
	    var r2 = new Array(xs.length);
	    for (var i = 0; i < xs.length; i++) {
	        r1[i] = xs[i][0];
	        r2[i] = xs[i][1];
	    }
	    return [r1, r2];
	}
	exports.unzip = unzip;
	function range(from, to) {
	    var result = Array(to - from + 1);
	    for (var i = from; i <= to; i++) {
	        result[i - from] = i;
	    }
	    return result;
	}
	exports.range = range;
	function copy(xs) {
	    return xs.slice(0);
	}
	exports.copy = copy;
	function apply_permutation(p, xs) {
	    var n = xs.length;
	    var result = new Array(n);
	    for (var i = 0; i < n; i++) {
	        result[i] = xs[p[i]];
	    }
	    return result;
	}
	exports.apply_permutation = apply_permutation;
	function next_permutation(p) {
	    var n = p.length;
	    if (n < 2)
	        return null;
	    var r = copy(p);
	    var k = n - 2;
	    for (; k >= 0 && r[k] >= r[k + 1]; k--)
	        ;
	    if (k < 0)
	        return null;
	    for (var i = k + 1, j = n - 1; i < j; i++, j--) {
	        var t_1 = r[i];
	        r[i] = r[j];
	        r[j] = t_1;
	    }
	    var next = k + 1;
	    for (; r[next] <= r[k]; next++)
	        ;
	    var t = r[k];
	    r[k] = r[next];
	    r[next] = t;
	    return r;
	}
	exports.next_permutation = next_permutation;

/***/ },
/* 2 */
/***/ function(module, exports) {

	function min(a, b) {
	    return a < b ? a : b;
	}
	exports.min = min;
	function max(a, b) {
	    return a < b ? b : a;
	}
	exports.max = max;
	function curry(f) {
	    return function (x) { return function (y) { return f(x, y); }; };
	}
	exports.curry = curry;
	function uncurry(f) {
	    return function (x, y) { return f(x)(y); };
	}
	exports.uncurry = uncurry;
	function id(x) {
	    return x;
	}
	exports.id = id;
	function constant(x) {
	    return function (_) { return x; };
	}
	exports.constant = constant;
	function flip(f) {
	    return function (y) { return function (x) { return f(x)(y); }; };
	}
	exports.flip = flip;
	function flip2(f) {
	    return function (y, x) { return f(x, y); };
	}
	exports.flip2 = flip2;
	function compose(g, f) {
	    return function (x) { return g(f(x)); };
	}
	exports.compose = compose;

/***/ }
/******/ ]);


Array.prototype.sub_reverse = function(x,y) {
	var a = this;
	var n = a.length;
	for (var i = 0; i+i < (y - x); i++) {
		var temp = a[x+i];
		a[x+i] = a[y-1-i];
		a[y-1-i] = temp;
	}
}

Array.prototype.next_permutation = function(){
	var a = this;
	var n = a.length;
	if (n < 2) return false;

	//Find the largest index k such that a[k] < a[k + 1]. If no such index exists, the permutation is the last permutation.
	for (var k = n-2; k >= 0 && a[k] >= a[k+1]; --k){}
	if (k == -1) return false;

	//Find the largest index l greater than k such that a[k] < a[l].
	for (var l = n-1;  k < l && a[k] >= a[l]; --l){}
	if (k == l) return false;

	//Swap the value of a[k] with that of a[l].
	var temp = a[k];
	a[k] = a[l];
	a[l] = temp;

	//Reverse the sequence from a[k + 1] up to and including the final element a[n].
	a.sub_reverse(k+1,n);
	return true;
}

function solve(a) {
	var A = {x:a[0][0], y:a[0][1]};
	var B = {x:a[1][0], y:a[1][1]};
	var C = {x:a[2][0], y:a[2][1]};

	// line
	// AA
	// BB
	// CC
	if (A.x == B.x && B.x == C.x && A.x == (A.y + B.y + C.y) ) {
		write(A.x + "\n");
		for (var i = 0; i < A.y; i++) {
			for (var j = 0; j < A.x; j++)
				write("A");
			write("\n");
		}
		for (var i = 0; i < B.y; i++) {
			for (var j = 0; j < B.x; j++)
				write("B");
			write("\n");
		}
		for (var i = 0; i < C.y; i++) {
			for (var j = 0; j < C.x; j++)
				write("C");
			write("\n");
		}
		return true;
	}

	// ABB
	// ACC

	if (B.x == C.x && A.y == (B.y+C.y)) {
		write(A.y + "\n");
		for (var i = 0; i < B.y; i++) {
			for (var j = 0; j < A.x; j++) write("A");
			for (var j = 0; j < B.x; j++) write("B");
			write("\n");
		}
		for (var i = 0; i < C.y; i++) {
			for (var j = 0; j < A.x; j++) write("A");
			for (var j = 0; j < C.x; j++) write("C");
			write("\n");
		}
		return true;
	}
	return false;
}

function main() {
	a = readline().split(" ").map(Number);

	var order = [0,1,2];
	do {
		// 2d array
		var b = [];
		for (var i = 0; i < 3; i++) {
			b.push([ a[2*order[i]], a[2*order[i]+1] ]);
		}

		for (var rotation_mask = 0; rotation_mask < 8; rotation_mask++) {
			var c = [];
			// rotate
			for (var i = 0; i < 3; i++)
				if (rotation_mask & (1<<i)) {
					c[i] = b[i].slice(0).reverse();
				} else {
					c[i] = b[i].slice();
				}
			result = solve(c);
			if (result) break;
		}
		if (result) break;
	} while (order.next_permutation());

	if (!result) {
		write("-1\n");
	}
}

main();


Array.prototype.sub_reverse = function(x,y) {
	var a = this;
	var n = a.length;
	for (var i = 0; i+i < (y - x); i++) {
		var temp = a[x+i];
		a[x+i] = a[y-1-i];
		a[y-1-i] = temp;
	}
}

Array.prototype.next_permutation = function(){
	var a = this;
	var n = a.length;
	if (n < 2) return false;

	//Find the largest index k such that a[k] < a[k + 1]. If no such index exists, the permutation is the last permutation.
	for (var k = n-2; k >= 0 && a[k] >= a[k+1]; --k){}
	if (k == -1) return false;

	//Find the largest index l greater than k such that a[k] < a[l].
	for (var l = n-1;  k < l && a[k] >= a[l]; --l){}
	if (k == l) return false;

	//Swap the value of a[k] with that of a[l].
	var temp = a[k];
	a[k] = a[l];
	a[l] = temp;

	//Reverse the sequence from a[k + 1] up to and including the final element a[n].
	a.sub_reverse(k+1,n);
	return true;
}

function solve(a,order) {
	var letter = ["A","B","C"];
	var A = {x:a[0][0], y:a[0][1], letter:letter[order[0]]};
	var B = {x:a[1][0], y:a[1][1], letter:letter[order[1]]};
	var C = {x:a[2][0], y:a[2][1], letter:letter[order[2]]};

	// AA
	// BB
	// CC
	if (A.x == B.x && B.x == C.x && A.x == (A.y + B.y + C.y) ) {
		write(A.x + "\n");
		for (var i = 0; i < A.y; i++) {
			for (var j = 0; j < A.x; j++)
				write(A.letter);
			write("\n");
		}
		for (var i = 0; i < B.y; i++) {
			for (var j = 0; j < B.x; j++)
				write(B.letter);
			write("\n");
		}
		for (var i = 0; i < C.y; i++) {
			for (var j = 0; j < C.x; j++)
				write(C.letter);
			write("\n");
		}
		return true;
	}

	// ABB
	// ACC
	if (B.x == C.x && A.y == (B.y+C.y) && A.y == (A.x + B.x)) {
		write(A.y + "\n");
		for (var i = 0; i < B.y; i++) {
			for (var j = 0; j < A.x; j++) write(A.letter);
			for (var j = 0; j < B.x; j++) write(B.letter);
			write("\n");
		}
		for (var i = 0; i < C.y; i++) {
			for (var j = 0; j < A.x; j++) write(A.letter);
			for (var j = 0; j < C.x; j++) write(C.letter);
			write("\n");
		}
		return true;
	}
	return false;
}

function main() {
	a = readline().split(" ").map(Number);

	var order = [0,1,2];
	do {
		// 2d array
		var b = [];
		for (var i = 0; i < 3; i++) {
			b.push([ a[2*order[i]], a[2*order[i]+1] ]);
		}

		for (var rotation_mask = 0; rotation_mask < 8; rotation_mask++) {
			var c = [];
			// rotate
			for (var i = 0; i < 3; i++)
				if (rotation_mask & (1<<i)) {
					c[i] = b[i].slice(0).reverse();
				} else {
					c[i] = b[i].slice();
				}
			result = solve(c, order);
			if (result) break;
		}
		if (result) break;
	} while (order.next_permutation());

	if (!result) {
		write("-1\n");
	}
}

main();


Array.prototype.sub_reverse = function(x,y) {
	var a = this;
	var n = a.length;
	for (var i = 0; i+i < (y - x); i++) {
		var temp = a[x+i];
		a[x+i] = a[y-1-i];
		a[y-1-i] = temp;
	}
}

Array.prototype.next_permutation = function(){
	var a = this;
	var n = a.length;
	if (n < 2) return false;

	//Find the largest index k such that a[k] < a[k + 1]. If no such index exists, the permutation is the last permutation.
	for (var k = n-2; k >= 0 && a[k] >= a[k+1]; --k){}
	if (k == -1) return false;

	//Find the largest index l greater than k such that a[k] < a[l].
	for (var l = n-1;  k < l && a[k] >= a[l]; --l){}
	if (k == l) return false;

	//Swap the value of a[k] with that of a[l].
	var temp = a[k];
	a[k] = a[l];
	a[l] = temp;

	//Reverse the sequence from a[k + 1] up to and including the final element a[n].
	a.sub_reverse(k+1,n);
	return true;
}

function solve(a,order) {
	var letter = ["A","B","C"];
	var A = {x:a[0][0], y:a[0][1], letter:letter[order[0]]};
	var B = {x:a[1][0], y:a[1][1], letter:letter[order[1]]};
	var C = {x:a[2][0], y:a[2][1], letter:letter[order[2]]};

	// AA
	// BB
	// CC
	if (A.x == B.x && B.x == C.x && A.x == (A.y + B.y + C.y) ) {
		write(A.x + "\n");
		for (var i = 0; i < A.y; i++) {
			for (var j = 0; j < A.x; j++)
				write(A.letter);
			write("\n");
		}
		for (var i = 0; i < B.y; i++) {
			for (var j = 0; j < B.x; j++)
				write(B.letter);
			write("\n");
		}
		for (var i = 0; i < C.y; i++) {
			for (var j = 0; j < C.x; j++)
				write(C.letter);
			write("\n");
		}
		return true;
	}

	// ABB
	// ACC

	if (B.x == C.x && A.y == (B.y+C.y)) {
		write(A.y + "\n");
		for (var i = 0; i < B.y; i++) {
			for (var j = 0; j < A.x; j++) write(A.letter);
			for (var j = 0; j < B.x; j++) write(B.letter);
			write("\n");
		}
		for (var i = 0; i < C.y; i++) {
			for (var j = 0; j < A.x; j++) write(A.letter);
			for (var j = 0; j < C.x; j++) write(C.letter);
			write("\n");
		}
		return true;
	}
	return false;
}

function main() {
	a = readline().split(" ").map(Number);

	var order = [0,1,2];
	do {
		// 2d array
		var b = [];
		for (var i = 0; i < 3; i++) {
			b.push([ a[2*order[i]], a[2*order[i]+1] ]);
		}

		for (var rotation_mask = 0; rotation_mask < 8; rotation_mask++) {
			var c = [];
			// rotate
			for (var i = 0; i < 3; i++)
				if (rotation_mask & (1<<i)) {
					c[i] = b[i].slice(0).reverse();
				} else {
					c[i] = b[i].slice();
				}
			result = solve(c, order);
			if (result) break;
		}
		if (result) break;
	} while (order.next_permutation());

	if (!result) {
		write("-1\n");
	}
}

main();


#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <cctype>
#include <set>
#include <bitset>
#include <algorithm>
#include <list>
#include <vector>
#include <sstream>
#include <iostream>
#include<time.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> paii;

#define PI (2*acos(0))
#define ERR 1e-20
#define mem(a,b) memset(a,b,sizeof a)
#define pb push_back
#define popb pop_back
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define SZ(x) (int)x.size()
#define oo (1<<25)
#define FOREACH(it,x) for(__typeof((x).begin()) it=(x.begin()); it!=(x).end(); ++it)
#define Contains(X,item)        ((X).find(item) != (X).end())
#define popc(i) (__builtin_popcount(i))
#define fs      first
#define sc      second
#define EQ(a,b)     (fabs(a-b)<ERR)
#define MAX 55
#define wait getchar()

int main()
{
//    freopen("in.txt","r",stdin);
//    freopen("out.txt","w",stdout);

    int x[3],y[3],need_x,need_y,used;
    vector<int> unused;

    char company[]={'A','B','C'};

    for(int i=0;i<3;i++) cin>>x[i]>>y[i];

    if(x[0]<y[0]) swap(x[0],y[0]);
    if(x[1]<y[1]) swap(x[1],y[1]);
    if(x[2]<y[2]) swap(x[2],y[2]);

    int area=x[0]*y[0]+x[1]*y[1]+x[2]*y[2];

    float len=sqrt(area);

    if(len-(int)len>0.0 || x[0]>(int)len || x[1]>(int)len || x[2]>(int)len)
        cout<<"-1"<<endl;

    else
    {
        cout<<(int)len<<endl;

        char arr[(int)len][(int)len];

        for(int i=0;i<len;i++)
            for(int j=0;j<len;j++)
                arr[i][j]='.';

        used=-1;

        for(int i=0;i<3;i++)
        {
            if(x[i]==len)
            {
                for(int j=0;j<len;j++)
                    for(int k=0;k<y[i];k++)
                        arr[k][j]=company[i];

                used=i;

                for(int i=0;i<3;i++) if(i!=used) unused.pb(i);

                need_x=len;
                need_y=len-y[i];

                break;
            }
        }

        int rec1,rec2;

        if(x[unused[0]]==len && x[unused[1]]==len)
        {
            rec1=unused[0];
            rec2=unused[1];

            for(int j=0;j<len;j++)
                for(int i=y[used];i<y[used]+y[rec1];i++)
                    arr[i][j]=company[rec1];

            for(int j=0;j<len;j++)
                for(int i=y[used]+y[rec1];i<y[used]+y[rec1]+y[rec2];i++)
                    arr[i][j]=company[rec2];

        }

        else if(y[unused[0]]==need_y || y[unused[1]]==need_y)
        {
            if(y[unused[0]]==need_y)
            {
                rec1=unused[0];
                rec2=unused[1];
            }
            else
            {
                rec2=unused[0];
                rec1=unused[1];
            }

            if(need_x-x[rec1]!=x[rec2]) swap(x[rec2],y[rec2]);

            for(int j=0;j<x[rec1];j++)
                for(int i=y[used];i<y[used]+need_y;i++)
                    arr[i][j]=company[rec1];

            for(int j=x[rec1];j<x[rec1]+x[rec2];j++)
                for(int i=y[used];i<y[used]+need_y;i++)
                    arr[i][j]=company[rec2];
        }

        for(int i=0;i<len;i++)
        {
            for(int j=0;j<len;j++) printf("%c",arr[i][j]);
            printf("\n");
        }

    }

    return 0;
}


#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <cctype>
#include <set>
#include <bitset>
#include <algorithm>
#include <list>
#include <vector>
#include <sstream>
#include <iostream>
#include<time.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> paii;

#define PI (2*acos(0))
#define ERR 1e-20
#define mem(a,b) memset(a,b,sizeof a)
#define pb push_back
#define popb pop_back
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define SZ(x) (int)x.size()
#define oo (1<<25)
#define FOREACH(it,x) for(__typeof((x).begin()) it=(x.begin()); it!=(x).end(); ++it)
#define Contains(X,item)        ((X).find(item) != (X).end())
#define popc(i) (__builtin_popcount(i))
#define fs      first
#define sc      second
#define EQ(a,b)     (fabs(a-b)<ERR)
#define MAX 55
#define wait getchar()

int main()
{
//    freopen("in.txt","r",stdin);
//    freopen("out.txt","w",stdout);

    int x[3],y[3],need_x,need_y,used;
    vector<int> unused;

    char company[]={'A','B','C'};

    for(int i=0;i<3;i++) cin>>x[i]>>y[i];

    if(x[0]<y[0]) swap(x[0],y[0]);
    if(x[1]<y[1]) swap(x[1],y[1]);
    if(x[2]<y[2]) swap(x[2],y[2]);

    int area=x[0]*y[0]+x[1]*y[1]+x[2]*y[2];

    float len=sqrt(area);

    if(len-(int)len>0.0 || x[0]>(int)len || x[1]>(int)len || x[2]>(int)len)
        cout<<"-1"<<endl;

    else
    {
        cout<<(int)len<<endl;

        char arr[(int)len][(int)len];

        for(int i=0;i<len;i++)
            for(int j=0;j<len;j++)
                arr[i][j]='.';

        used=-1;

        for(int i=0;i<3;i++)
        {
            if(x[i]==len)
            {
                for(int j=0;j<len;j++)
                    for(int k=0;k<y[i];k++)
                        arr[k][j]=company[i];

                used=i;

                for(int i=0;i<3;i++) if(i!=used) unused.pb(i);

                need_x=len;
                need_y=len-y[i];

                break;
            }
        }

        if(x[unused[0]]==need_y) swap(x[unused[0]],y[unused[0]]);
        if(x[unused[1]]==need_y) swap(x[unused[1]],y[unused[1]]);
        if(x[unused[1]]>x[unused[0]]) swap(unused[0],unused[1]);

        int rec1,rec2;

        if(x[unused[0]]==len && x[unused[1]]==len)
        {
            rec1=unused[0];
            rec2=unused[1];

            for(int j=0;j<len;j++)
                for(int i=y[used];i<y[used]+y[rec1];i++)
                    arr[i][j]=company[rec1];

            for(int j=0;j<len;j++)
                for(int i=y[used]+y[rec1];i<y[used]+y[rec1]+y[rec2];i++)
                    arr[i][j]=company[rec2];

        }

        else if(y[unused[0]]==need_y || y[unused[1]]==need_y)
        {
            if(y[unused[0]]==need_y)
            {
                rec1=unused[0];
                rec2=unused[1];
            }
            else
            {
                rec2=unused[0];
                rec1=unused[1];
            }

            if(need_x-x[rec1]!=x[rec2]) swap(x[rec2],y[rec2]);

            for(int j=0;j<x[rec1];j++)
                for(int i=y[used];i<y[used]+need_y;i++)
                    arr[i][j]=company[rec1];

            for(int j=x[rec1];j<x[rec1]+x[rec2];j++)
                for(int i=y[used];i<y[used]+need_y;i++)
                    arr[i][j]=company[rec2];
        }

        for(int i=0;i<len;i++)
        {
            for(int j=0;j<len;j++) printf("%c",arr[i][j]);
            printf("\n");
        }

    }

    return 0;
}


#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <cctype>
#include <set>
#include <bitset>
#include <algorithm>
#include <list>
#include <vector>
#include <sstream>
#include <iostream>
#include<time.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> paii;

#define PI (2*acos(0))
#define ERR 1e-20
#define mem(a,b) memset(a,b,sizeof a)
#define pb push_back
#define popb pop_back
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define SZ(x) (int)x.size()
#define oo (1<<25)
#define FOREACH(it,x) for(__typeof((x).begin()) it=(x.begin()); it!=(x).end(); ++it)
#define Contains(X,item)        ((X).find(item) != (X).end())
#define popc(i) (__builtin_popcount(i))
#define fs      first
#define sc      second
#define EQ(a,b)     (fabs(a-b)<ERR)
#define MAX 55
#define wait getchar()

int main()
{
//    freopen("in.txt","r",stdin);
//    freopen("out.txt","w",stdout);

    int x[3],y[3],need_x,need_y,used;
    vector<int> unused;

    char company[]={'A','B','C'};

    for(int i=0;i<3;i++) cin>>x[i]>>y[i];

    if(x[0]<y[0]) swap(x[0],y[0]);
    if(x[1]<y[1]) swap(x[1],y[1]);
    if(x[2]<y[2]) swap(x[2],y[2]);

    int area=x[0]*y[0]+x[1]*y[1]+x[2]*y[2];

    float len=sqrt(area);

    if(len-(int)len>0.0 || x[0]>(int)len || x[1]>(int)len || x[2]>(int)len)
        cout<<"-1"<<endl;

    else
    {
        cout<<(int)len<<endl;

        char arr[(int)len][(int)len];

        for(int i=0;i<len;i++)
            for(int j=0;j<len;j++)
                arr[i][j]='.';

        used=-1;

        for(int i=0;i<3;i++)
        {
            if(x[i]==len)
            {
                for(int j=0;j<len;j++)
                    for(int k=0;k<y[i];k++)
                        arr[k][j]=company[i];

                used=i;

                for(int i=0;i<3;i++) if(i!=used) unused.pb(i);

                need_x=len;
                need_y=len-y[i];

                break;
            }
        }

        int rec1,rec2;

        if(x[unused[0]]==len && x[unused[1]]==len)
        {
            rec1=unused[0];
            rec2=unused[1];

            for(int j=0;j<len;j++)
                for(int i=y[used];i<y[used]+y[rec1];i++)
                    arr[i][j]=company[rec1];

            for(int j=0;j<len;j++)
                for(int i=y[used]+y[rec1];i<y[used]+y[rec1]+y[rec2];i++)
                    arr[i][j]=company[rec2];

        }

        else if(y[unused[0]]==need_y || y[unused[1]]==need_y)
        {
            if(y[unused[0]]==need_y)
            {
                rec1=unused[0];
                rec2=unused[1];
            }
            else
            {
                rec2=unused[0];
                rec1=unused[1];
            }

            swap(x[rec2],y[rec2]);

            for(int j=0;j<x[rec1];j++)
                for(int i=y[used];i<y[used]+need_y;i++)
                    arr[i][j]=company[rec1];

            for(int j=x[rec1];j<x[rec1]+x[rec2];j++)
                for(int i=y[used];i<y[used]+need_y;i++)
                    arr[i][j]=company[rec2];
        }

        for(int i=0;i<len;i++)
        {
            for(int j=0;j<len;j++) printf("%c",arr[i][j]);
            printf("\n");
        }

    }

    return 0;
}


#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <cctype>
#include <set>
#include <bitset>
#include <algorithm>
#include <list>
#include <vector>
#include <sstream>
#include <iostream>
#include<time.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> paii;

#define PI (2*acos(0))
#define ERR 1e-20
#define mem(a,b) memset(a,b,sizeof a)
#define pb push_back
#define popb pop_back
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define SZ(x) (int)x.size()
#define oo (1<<25)
#define FOREACH(it,x) for(__typeof((x).begin()) it=(x.begin()); it!=(x).end(); ++it)
#define Contains(X,item)        ((X).find(item) != (X).end())
#define popc(i) (__builtin_popcount(i))
#define fs      first
#define sc      second
#define EQ(a,b)     (fabs(a-b)<ERR)
#define MAX 55
#define wait getchar()

int main()
{
//    freopen("in.txt","r",stdin);
//    freopen("out.txt","w",stdout);

    int x[3],y[3],need_x,need_y,used;
    vector<int> unused;

    char company[]={'A','B','C'};

    for(int i=0;i<3;i++) cin>>x[i]>>y[i];

    if(x[0]<y[0]) swap(x[0],y[0]);
    if(x[1]<y[1]) swap(x[1],y[1]);
    if(x[2]<y[2]) swap(x[2],y[2]);

    int area=x[0]*y[0]+x[1]*y[1]+x[2]*y[2];

    float len=sqrt(area);

    if(len-(int)len>0.0 || x[0]>(int)len || x[1]>(int)len || x[2]>(int)len || (x[0]!=len && x[1]!=len && x[2]!=len))
        cout<<"-1"<<endl;

    else
    {
        cout<<(int)len<<endl;

        char arr[(int)len][(int)len];

        for(int i=0;i<len;i++)
            for(int j=0;j<len;j++)
                arr[i][j]='.';

        used=-1;

        for(int i=0;i<3;i++)
        {
            if(x[i]==len)
            {
                for(int j=0;j<len;j++)
                    for(int k=0;k<y[i];k++)
                        arr[k][j]=company[i];

                used=i;

                for(int i=0;i<3;i++) if(i!=used) unused.pb(i);

                need_x=len;
                need_y=len-y[i];

                break;
            }
        }

        if(x[unused[0]]==need_y) swap(x[unused[0]],y[unused[0]]);
        if(x[unused[1]]==need_y) swap(x[unused[1]],y[unused[1]]);
        if(x[unused[1]]>x[unused[0]]) swap(unused[0],unused[1]);

        int rec1,rec2;

        if(x[unused[0]]==len && x[unused[1]]==len)
        {
            rec1=unused[0];
            rec2=unused[1];

            for(int j=0;j<len;j++)
                for(int i=y[used];i<y[used]+y[rec1];i++)
                    arr[i][j]=company[rec1];

            for(int j=0;j<len;j++)
                for(int i=y[used]+y[rec1];i<y[used]+y[rec1]+y[rec2];i++)
                    arr[i][j]=company[rec2];

        }

        else if(y[unused[0]]==need_y || y[unused[1]]==need_y)
        {
            if(y[unused[0]]==need_y)
            {
                rec1=unused[0];
                rec2=unused[1];
            }
            else
            {
                rec2=unused[0];
                rec1=unused[1];
            }

            if(need_x-x[rec1]!=x[rec2]) swap(x[rec2],y[rec2]);

            for(int j=0;j<x[rec1];j++)
                for(int i=y[used];i<y[used]+need_y;i++)
                    arr[i][j]=company[rec1];

            for(int j=x[rec1];j<x[rec1]+x[rec2];j++)
                for(int i=y[used];i<y[used]+need_y;i++)
                    arr[i][j]=company[rec2];
        }

        for(int i=0;i<len;i++)
        {
            for(int j=0;j<len;j++) printf("%c",arr[i][j]);
            printf("\n");
        }

    }

    return 0;
}


#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <cctype>
#include <set>
#include <bitset>
#include <algorithm>
#include <list>
#include <vector>
#include <sstream>
#include <iostream>
#include<time.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> paii;

#define PI (2*acos(0))
#define ERR 1e-20
#define mem(a,b) memset(a,b,sizeof a)
#define pb push_back
#define popb pop_back
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define SZ(x) (int)x.size()
#define oo (1<<25)
#define FOREACH(it,x) for(__typeof((x).begin()) it=(x.begin()); it!=(x).end(); ++it)
#define Contains(X,item)        ((X).find(item) != (X).end())
#define popc(i) (__builtin_popcount(i))
#define fs      first
#define sc      second
#define EQ(a,b)     (fabs(a-b)<ERR)
#define MAX 55
#define wait getchar()

int main()
{
//    freopen("in.txt","r",stdin);
//    freopen("out.txt","w",stdout);

    int x[3],y[3],need_x,need_y,used;
    vector<int> unused;

    char company[]={'A','B','C'};

    for(int i=0;i<3;i++) cin>>x[i]>>y[i];

    if(x[0]<y[0]) swap(x[0],y[0]);
    if(x[1]<y[1]) swap(x[1],y[1]);
    if(x[2]<y[2]) swap(x[2],y[2]);

    int area=x[0]*y[0]+x[1]*y[1]+x[2]*y[2];

    float len=sqrt(area);

    if(len-(int)len>0.0 || x[0]>(int)len || x[1]>(int)len || x[2]>(int)len)
        cout<<"-1"<<endl;

    else
    {
        cout<<(int)len<<endl;

        char arr[(int)len][(int)len];

        for(int i=0;i<len;i++)
            for(int j=0;j<len;j++)
                arr[i][j]='.';

        used=-1;

        for(int i=0;i<3;i++)
        {
            if(x[i]==len)
            {
                for(int j=0;j<len;j++)
                    for(int k=0;k<y[i];k++)
                        arr[k][j]=company[i];

                used=i;

                for(int i=0;i<3;i++) if(i!=used) unused.pb(i);

                need_x=len;
                need_y=len-y[i];

                break;
            }
        }

        if(x[unused[0]]==need_y) swap(x[unused[0]],y[unused[0]]);
        if(x[unused[1]]==need_y) swap(x[unused[1]],y[unused[1]]);
        if(x[unused[1]]>x[unused[0]]) swap(unused[0],unused[1]);

        int rec1,rec2;

        if(x[unused[0]]==len && x[unused[1]]==len)
        {
            rec1=unused[0];
            rec2=unused[1];

            for(int j=0;j<len;j++)
                for(int i=y[used];i<y[used]+y[rec1];i++)
                    arr[i][j]=company[rec1];

            for(int j=0;j<len;j++)
                for(int i=y[used]+y[rec1];i<y[used]+y[rec1]+y[rec2];i++)
                    arr[i][j]=company[rec2];

        }

        else if(y[unused[0]]==need_y || y[unused[1]]==need_y)
        {
            cout<<"in"<<endl;

            if(y[unused[0]]==need_y)
            {
                rec1=unused[0];
                rec2=unused[1];
            }
            else
            {
                rec2=unused[0];
                rec1=unused[1];
            }

            if(need_x-x[rec1]!=x[rec2]) swap(x[rec2],y[rec2]);

            for(int j=0;j<x[rec1];j++)
                for(int i=y[used];i<y[used]+need_y;i++)
                    arr[i][j]=company[rec1];

            for(int j=x[rec1];j<x[rec1]+x[rec2];j++)
                for(int i=y[used];i<y[used]+need_y;i++)
                    arr[i][j]=company[rec2];
        }

        for(int i=0;i<len;i++)
        {
            for(int j=0;j<len;j++) printf("%c",arr[i][j]);
            printf("\n");
        }

    }

    return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <algorithm>
#define pb push_back
#define fname ""
#define ll long long
#define s second
#define f first
#define mp make_pair

using namespace std;

pair <int, int> p[4];
int ans, x, y;
char c[555][555];
bool flag;

int main() {

    cin >> p[1].f >> p[1].s >> p[2].f >>p[2].s >> p[3].f >> p[3].s;
    for (int i = 1; i <= 3; i++)
        for (int j = 1; j <= 3; j++) {
            int k = 6 - i - j;
            if (p[i].f == p[j].f) {
                    x = p[i].s + p[j].s;
                    y = p[i].f;
                    if (x == p[k].f) {
                        if (x == y+p[k].s) {
                            ans = x;
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = 1; h <= p[i].s; h++)
                                c[z][h] = 'A';
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = p[i].s+1; h <= p[k].f; h++)
                                c[z][h] = 'B';
                            for (int z = p[i].f+1; z <= p[i].f + p[k].s; z++)
                            for (int h = 1; h <= p[k].f; h++)
                                c[z][h] = 'C'
                            flag = true;
                        }
                    }
                    if (x == p[k].s) {
                        if (x == y+p[k].f) {
                            ans = x;
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = 1; h <= p[i].s; h++)
                                c[z][h] = 'A';
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = p[i].s+1; h <= p[k].s; h++)
                                c[z][h] = 'B';
                            for (int z = p[i].f+1; z <= p[i].f + p[k].f; z++)
                            for (int h = 1; h <= p[k].s; h++)
                                c[z][h] = 'C'
                            flag = true;
                        }

                    }
                    if (y == p[k].f) {
                        if (x + p[k].s == y) {
                            flag = true;
                            ans = y;
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = 1; h <= p[i].s; h++)
                                c[z][h] = 'A';
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = p[i].s+1; h <= x; h++)
                                c[z][h] = 'B';
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = x+1; h <= x+p[k].s; h++)
                                c[z][h] = 'C';
                        }
                    }
                    if (y == p[k].s) {
                        if (x + p[k].f == y) {
                            flag = true;
                            ans = y;
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = 1; h <= p[i].s; h++)
                                c[z][h] = 'A';
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = p[i].s+1; h <= x; h++)
                                c[z][h] = 'B';
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = x+1; h <= x+p[k].f; h++)
                                c[z][h] = 'C';
                        }
                    }
            }
            if (p[i].f == p[j].s) {
                    x = p[i].s + p[j].f;
                    y = p[i].f;
                    if (x == p[k].f) {
                        if (x == y+p[k].s) {
                            ans = x;
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = 1; h <= p[i].s; h++)
                                c[z][h] = 'A';
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = p[i].s+1; h <= x; h++)
                                c[z][h] = 'B';
                            for (int z = p[i].f+1; z <= p[i].f + p[k].s; z++)
                            for (int h = 1; h <= x; h++)
                                c[z][h] = 'C'
                            flag = true;
                        }
                    }
                    if (x == p[k].s) {
                        if (x == y+p[k].f) {
                            ans = x;
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = 1; h <= p[i].s; h++)
                                c[z][h] = 'A';
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = p[i].s+1; h <= x; h++)
                                c[z][h] = 'B';
                            for (int z = p[i].f+1; z <= p[i].f + p[k].f; z++)
                            for (int h = 1; h <= p[k].s; h++)
                                c[z][h] = 'C'
                            flag = true;
                        }

                    }
                    if (y == p[k].f) {
                        if (x + p[k].s == y) {
                            flag = true;
                            ans = y;
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = 1; h <= p[i].s; h++)
                                c[z][h] = 'A';
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = p[i].s+1; h <= x; h++)
                                c[z][h] = 'B';
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = x+1; h <= x+p[k].s; h++)
                                c[z][h] = 'C';
                        }
                    }
                    if (y == p[k].s) {
                        if (x + p[k].f == y) {
                            flag = true;
                            ans = y;
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = 1; h <= p[i].s; h++)
                                c[z][h] = 'A';
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = p[i].s+1; h <= x; h++)
                                c[z][h] = 'B';
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = x+1; h <= x+p[k].f; h++)
                                c[z][h] = 'C';
                        }
                    }
            }
            if (flag) break;
        }
        if (flag) {
            cout << ans << endl;
            for (int i = 1; i <= n; i++) {
                for (int j = 1; j <= n; j++)
                    cout << c[i][j];
                cout << endl;
            }
        } else
            cout << -1;
    //  system("pause");
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <algorithm>
#define pb push_back
#define fname ""
#define ll long long
#define s second
#define f first
#define mp make_pair

using namespace std;

pair <int, int> p[4];
int ans, x, y;
char c[555][555];
bool flag;

int main() {
    #ifndef ONLINE_JUDGE
    freopen(fname"in", "r", stdin);
    freopen(fname"out", "w", stdout);
    #endif

    cin >> p[1].f >> p[1].s >> p[2].f >>p[2].s >> p[3].f >> p[3].s;
    for (int i = 1; i <= 3; i++)
        for (int j = 1; j <= 3; j++) {
            if (i == j) continue;
            if (flag) break;
            int k = 6 - i - j;
            if (p[i].f == p[j].f) {
                    x = p[i].s + p[j].s;
                    y = p[i].f;
                    if (x == p[k].f) {
                        if (x == y+p[k].s) {
                            ans = x;
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = 1; h <= p[i].s; h++)
                                c[z][h] = 'A';
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = p[i].s+1; h <= p[k].f; h++)
                                c[z][h] = 'B';
                            for (int z = p[i].f+1; z <= p[i].f + p[k].s; z++)
                            for (int h = 1; h <= p[k].f; h++)
                                c[z][h] = 'C';
                            flag = true;
                            break;
                        }
                    }
                    if (x == p[k].s) {
                        if (x == y+p[k].f) {
                            ans = x;
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = 1; h <= p[i].s; h++)
                                c[z][h] = 'A';
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = p[i].s+1; h <= p[k].s; h++)
                                c[z][h] = 'B';
                            for (int z = p[i].f+1; z <= p[i].f + p[k].f; z++)
                            for (int h = 1; h <= p[k].s; h++)
                                c[z][h] = 'C';
                            flag = true;
                            break;
                        }
                    }
                    if (y == p[k].f) {
                        if (x + p[k].s == y) {
                            flag = true;
                            ans = y;
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = 1; h <= p[i].s; h++)
                                c[z][h] = 'A';
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = p[i].s+1; h <= x; h++)
                                c[z][h] = 'B';
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = x+1; h <= x+p[k].s; h++)
                                c[z][h] = 'C';
                            break;
                        }
                    }
                    if (y == p[k].s) {
                        if (x + p[k].f == y) {
                            flag = true;
                            ans = y;
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = 1; h <= p[i].s; h++)
                                c[z][h] = 'A';
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = p[i].s+1; h <= x; h++)
                                c[z][h] = 'B';
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = x+1; h <= x+p[k].f; h++)
                                c[z][h] = 'C';
                            break;
                        }
                    }
            }
            if (p[i].f == p[j].s) {
                    x = p[i].s + p[j].f;
                    y = p[i].f;
                    if (x == p[k].f) {
                        if (x == y+p[k].s) {
                            ans = x;
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = 1; h <= p[i].s; h++)
                                c[z][h] = 'A';
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = p[i].s+1; h <= x; h++)
                                c[z][h] = 'B';
                            for (int z = p[i].f+1; z <= p[i].f + p[k].s; z++)
                            for (int h = 1; h <= x; h++)
                                c[z][h] = 'C';
                            flag = true;
                            break;
                        }
                    }
                    if (x == p[k].s) {
                        if (x == y+p[k].f) {
                            ans = x;
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = 1; h <= p[i].s; h++)
                                c[z][h] = 'A';
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = p[i].s+1; h <= x; h++)
                                c[z][h] = 'B';
                            for (int z = p[i].f+1; z <= p[i].f + p[k].f; z++)
                            for (int h = 1; h <= p[k].s; h++)
                                c[z][h] = 'C';
                            flag = true;
                            break;
                        }

                    }
                    if (y == p[k].f) {
                        if (x + p[k].s == y) {
                            flag = true;
                            ans = y;
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = 1; h <= p[i].s; h++)
                                c[z][h] = 'A';
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = p[i].s+1; h <= x; h++)
                                c[z][h] = 'B';
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = x+1; h <= x+p[k].s; h++)
                                c[z][h] = 'C';
                            break;
                        }
                    }
                    if (y == p[k].s) {
                        if (x + p[k].f == y) {
                            flag = true;
                            ans = y;
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = 1; h <= p[i].s; h++)
                                c[z][h] = 'A';
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = p[i].s+1; h <= x; h++)
                                c[z][h] = 'B';
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = x+1; h <= x+p[k].f; h++)
                                c[z][h] = 'C';
                            break;
                        }
                    }
            }
        }
        if (flag) {
            cout << ans << endl;
            for (int i = 1; i <= ans; i++) {
                for (int j = 1; j <= ans; j++)
                    cout << c[i][j];
                cout << endl;
            }
        } else
            cout << -1;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <algorithm>
#define pb push_back
#define fname ""
#define ll long long
#define s second
#define f first
#define mp make_pair

using namespace std;

pair <int, int> p[4];
int ans, x, y;
char c[555][555], ch[4];
bool flag;

int main() {
    #ifndef ONLINE_JUDGE
    freopen(fname"in", "r", stdin);
    freopen(fname"out", "w", stdout);
    #endif

    cin >> p[1].f >> p[1].s >> p[2].f >>p[2].s >> p[3].f >> p[3].s;
    ch[1] = 'A';
    ch[2] = 'B';
    ch[3] = 'C';
    for (int i = 1; i <= 3; i++)
        for (int j = 1; j <= 3; j++) {
            if (i == j) continue;
            if (flag) break;
            int k = 6 - i - j;
            if (p[i].f == p[j].f) {
                    x = p[i].s + p[j].s;
                    y = p[i].f;
                    if (x == p[k].f) {
                        if (x == y+p[k].s) {
                            ans = x;
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = 1; h <= p[i].s; h++)
                                c[z][h] = ch[i];
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = p[i].s+1; h <= p[k].f; h++)
                                c[z][h] = ch[j];
                            for (int z = p[i].f+1; z <= p[i].f + p[k].s; z++)
                            for (int h = 1; h <= p[k].f; h++)
                                c[z][h] = ch[k];
                            flag = true;
                            break;
                        }
                    }
                    if (x == p[k].s) {
                        if (x == y+p[k].f) {
                            ans = x;
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = 1; h <= p[i].s; h++)
                                c[z][h] = ch[i];
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = p[i].s+1; h <= p[k].s; h++)
                                c[z][h] = ch[j];
                            for (int z = p[i].f+1; z <= p[i].f + p[k].f; z++)
                            for (int h = 1; h <= p[k].s; h++)
                                c[z][h] = ch[k];
                            flag = true;
                            break;
                        }
                    }
                    if (y == p[k].f) {
                        if (x + p[k].s == y) {
                            flag = true;
                            ans = y;
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = 1; h <= p[i].s; h++)
                                c[z][h] = ch[i];
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = p[i].s+1; h <= x; h++)
                                c[z][h] = ch[j];
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = x+1; h <= x+p[k].s; h++)
                                c[z][h] = ch[k];
                            break;
                        }
                    }
                    if (y == p[k].s) {
                        if (x + p[k].f == y) {
                            flag = true;
                            ans = y;
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = 1; h <= p[i].s; h++)
                                c[z][h] = ch[i];
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = p[i].s+1; h <= x; h++)
                                c[z][h] = ch[j];
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = x+1; h <= x+p[k].f; h++)
                                c[z][h] = ch[k];
                            break;
                        }
                    }
            }
            if (p[i].f == p[j].s) {
                    x = p[i].s + p[j].f;
                    y = p[i].f;
                    if (x == p[k].f) {
                        if (x == y+p[k].s) {
                            ans = x;
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = 1; h <= p[i].s; h++)
                                c[z][h] = ch[i];
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = p[i].s+1; h <= x; h++)
                                c[z][h] = ch[j];
                            for (int z = p[i].f+1; z <= p[i].f + p[k].s; z++)
                            for (int h = 1; h <= x; h++)
                                c[z][h] = ch[k];
                            flag = true;
                            break;
                        }
                    }
                    if (x == p[k].s) {
                        if (x == y+p[k].f) {
                            ans = x;
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = 1; h <= p[i].s; h++)
                                c[z][h] = ch[i];
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = p[i].s+1; h <= x; h++)
                                c[z][h] = ch[j];
                            for (int z = p[i].f+1; z <= p[i].f + p[k].f; z++)
                            for (int h = 1; h <= p[k].s; h++)
                                c[z][h] = ch[k];
                            flag = true;
                            break;
                        }

                    }
                    if (y == p[k].f) {
                        if (x + p[k].s == y) {
                            flag = true;
                            ans = y;
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = 1; h <= p[i].s; h++)
                                c[z][h] = ch[i];
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = p[i].s+1; h <= x; h++)
                                c[z][h] = ch[j];
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = x+1; h <= x+p[k].s; h++)
                                c[z][h] = ch[k];
                            break;
                        }
                    }
                    if (y == p[k].s) {
                        if (x + p[k].f == y) {
                            flag = true;
                            ans = y;
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = 1; h <= p[i].s; h++)
                                c[z][h] = ch[i];
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = p[i].s+1; h <= x; h++)
                                c[z][h] = ch[j];
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = x+1; h <= x+p[k].f; h++)
                                c[z][h] = ch[k];
                            break;
                        }
                    }
            }
        }
        if (flag) {
            cout << ans << endl;
            for (int i = 1; i <= ans; i++) {
                for (int j = 1; j <= ans; j++)
                    cout << c[i][j];
                cout << endl;
            }
        } else
            cout << -1;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <algorithm>
#define pb push_back
#define fname ""
#define ll long long
#define s second
#define f first
#define mp make_pair

using namespace std;

pair <int, int> p[4];
int ans, x, y;
char c[555][555];
bool flag;

int main() {

    cin >> p[1].f >> p[1].s >> p[2].f >>p[2].s >> p[3].f >> p[3].s;
    for (int i = 1; i <= 3; i++)
        for (int j = 1; j <= 3; j++) {
            int k = 6 - i - j;
            if (p[i].f == p[j].f) {
                    x = p[i].s + p[j].s;
                    y = p[i].f;
                    if (x == p[k].f) {
                        if (x == y+p[k].s) {
                            ans = x;
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = 1; h <= p[i].s; h++)
                                c[z][h] = 'A';
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = p[i].s+1; h <= p[k].f; h++)
                                c[z][h] = 'B';
                            for (int z = p[i].f+1; z <= p[i].f + p[k].s; z++)
                            for (int h = 1; h <= p[k].f; h++)
                                c[z][h] = 'C';
                            flag = true;
                        }
                    }
                    if (x == p[k].s) {
                        if (x == y+p[k].f) {
                            ans = x;
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = 1; h <= p[i].s; h++)
                                c[z][h] = 'A';
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = p[i].s+1; h <= p[k].s; h++)
                                c[z][h] = 'B';
                            for (int z = p[i].f+1; z <= p[i].f + p[k].f; z++)
                            for (int h = 1; h <= p[k].s; h++)
                                c[z][h] = 'C';
                            flag = true;
                        }

                    }
                    if (y == p[k].f) {
                        if (x + p[k].s == y) {
                            flag = true;
                            ans = y;
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = 1; h <= p[i].s; h++)
                                c[z][h] = 'A';
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = p[i].s+1; h <= x; h++)
                                c[z][h] = 'B';
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = x+1; h <= x+p[k].s; h++)
                                c[z][h] = 'C';
                        }
                    }
                    if (y == p[k].s) {
                        if (x + p[k].f == y) {
                            flag = true;
                            ans = y;
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = 1; h <= p[i].s; h++)
                                c[z][h] = 'A';
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = p[i].s+1; h <= x; h++)
                                c[z][h] = 'B';
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = x+1; h <= x+p[k].f; h++)
                                c[z][h] = 'C';
                        }
                    }
            }
            if (p[i].f == p[j].s) {
                    x = p[i].s + p[j].f;
                    y = p[i].f;
                    if (x == p[k].f) {
                        if (x == y+p[k].s) {
                            ans = x;
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = 1; h <= p[i].s; h++)
                                c[z][h] = 'A';
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = p[i].s+1; h <= x; h++)
                                c[z][h] = 'B';
                            for (int z = p[i].f+1; z <= p[i].f + p[k].s; z++)
                            for (int h = 1; h <= x; h++)
                                c[z][h] = 'C';
                            flag = true;
                        }
                    }
                    if (x == p[k].s) {
                        if (x == y+p[k].f) {
                            ans = x;
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = 1; h <= p[i].s; h++)
                                c[z][h] = 'A';
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = p[i].s+1; h <= x; h++)
                                c[z][h] = 'B';
                            for (int z = p[i].f+1; z <= p[i].f + p[k].f; z++)
                            for (int h = 1; h <= p[k].s; h++)
                                c[z][h] = 'C';
                            flag = true;
                        }

                    }
                    if (y == p[k].f) {
                        if (x + p[k].s == y) {
                            flag = true;
                            ans = y;
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = 1; h <= p[i].s; h++)
                                c[z][h] = 'A';
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = p[i].s+1; h <= x; h++)
                                c[z][h] = 'B';
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = x+1; h <= x+p[k].s; h++)
                                c[z][h] = 'C';
                        }
                    }
                    if (y == p[k].s) {
                        if (x + p[k].f == y) {
                            flag = true;
                            ans = y;
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = 1; h <= p[i].s; h++)
                                c[z][h] = 'A';
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = p[i].s+1; h <= x; h++)
                                c[z][h] = 'B';
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = x+1; h <= x+p[k].f; h++)
                                c[z][h] = 'C';
                        }
                    }
            }
            if (flag) break;
        }
        if (flag) {
            cout << ans << endl;
            for (int i = 1; i <= ans; i++) {
                for (int j = 1; j <= ans; j++)
                    cout << c[i][j];
                cout << endl;
            }
        } else
            cout << -1;
    //  system("pause");
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <algorithm>
#define pb push_back
#define fname ""
#define ll long long
#define s second
#define f first
#define mp make_pair

using namespace std;

pair <int, int> p[4];
int ans, x, y;
char c[555][555], ch[4];
bool flag;

int main() {
    #ifndef ONLINE_JUDGE
    freopen(fname"in", "r", stdin);
    freopen(fname"out", "w", stdout);
    #endif

    cin >> p[1].f >> p[1].s >> p[2].f >>p[2].s >> p[3].f >> p[3].s;
    ch[1] = 'A';
    ch[2] = 'B';
    ch[3] = 'C';
    for (int i = 1; i <= 3; i++)
        for (int j = i+1; j <= 3; j++) {
            if (flag) break;
            int k = 6 - i - j;
            if (p[i].f == p[j].f) {
                    x = p[i].s + p[j].s;
                    y = p[i].f;
                    if (x == p[k].f) {
                        if (x == y+p[k].s) {
                            ans = x;
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = 1; h <= p[i].s; h++)
                                c[z][h] = ch[i];
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = p[i].s+1; h <= p[k].f; h++)
                                c[z][h] = ch[j];
                            for (int z = p[i].f+1; z <= p[i].f + p[k].s; z++)
                            for (int h = 1; h <= p[k].f; h++)
                                c[z][h] = ch[k];
                            flag = true;
                            break;
                        }
                    }
                    if (x == p[k].s) {
                        if (x == y+p[k].f) {
                            ans = x;
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = 1; h <= p[i].s; h++)
                                c[z][h] = ch[i];
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = p[i].s+1; h <= p[k].s; h++)
                                c[z][h] = ch[j];
                            for (int z = p[i].f+1; z <= p[i].f + p[k].f; z++)
                            for (int h = 1; h <= p[k].s; h++)
                                c[z][h] = ch[k];
                            flag = true;
                            break;
                        }
                    }
                    if (y == p[k].f) {
                        if (x + p[k].s == y) {
                            flag = true;
                            ans = y;
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = 1; h <= p[i].s; h++)
                                c[z][h] = ch[i];
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = p[i].s+1; h <= x; h++)
                                c[z][h] = ch[j];
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = x+1; h <= x+p[k].s; h++)
                                c[z][h] = ch[k];
                            break;
                        }
                    }
                    if (y == p[k].s) {
                        if (x + p[k].f == y) {
                            flag = true;
                            ans = y;
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = 1; h <= p[i].s; h++)
                                c[z][h] = ch[i];
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = p[i].s+1; h <= x; h++)
                                c[z][h] = ch[j];
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = x+1; h <= x+p[k].f; h++)
                                c[z][h] = ch[k];
                            break;
                        }
                    }
            }
            if (p[i].f == p[j].s) {
                    x = p[i].s + p[j].f;
                    y = p[i].f;
                    if (x == p[k].f) {
                        if (x == y+p[k].s) {
                            ans = x;
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = 1; h <= p[i].s; h++)
                                c[z][h] = ch[i];
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = p[i].s+1; h <= x; h++)
                                c[z][h] = ch[j];
                            for (int z = p[i].f+1; z <= p[i].f + p[k].s; z++)
                            for (int h = 1; h <= x; h++)
                                c[z][h] = ch[k];
                            flag = true;
                            break;
                        }
                    }
                    if (x == p[k].s) {
                        if (x == y+p[k].f) {
                            ans = x;
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = 1; h <= p[i].s; h++)
                                c[z][h] = ch[i];
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = p[i].s+1; h <= x; h++)
                                c[z][h] = ch[j];
                            for (int z = p[i].f+1; z <= p[i].f + p[k].f; z++)
                            for (int h = 1; h <= p[k].s; h++)
                                c[z][h] = ch[k];
                            flag = true;
                            break;
                        }

                    }
                    if (y == p[k].f) {
                        if (x + p[k].s == y) {
                            flag = true;
                            ans = y;
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = 1; h <= p[i].s; h++)
                                c[z][h] = ch[i];
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = p[i].s+1; h <= x; h++)
                                c[z][h] = ch[j];
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = x+1; h <= x+p[k].s; h++)
                                c[z][h] = ch[k];
                            break;
                        }
                    }
                    if (y == p[k].s) {
                        if (x + p[k].f == y) {
                            flag = true;
                            ans = y;
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = 1; h <= p[i].s; h++)
                                c[z][h] = ch[i];
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = p[i].s+1; h <= x; h++)
                                c[z][h] = ch[j];
                            for (int z = 1; z <= p[i].f; z++)
                            for (int h = x+1; h <= x+p[k].f; h++)
                                c[z][h] = ch[k];
                            break;
                        }
                    }
            }
            if (p[i].s == p[j].f) {
                x = p[i].f + p[j].s;
                y = p[i].s;
                if (x == p[k].f) {
                    if (x == y + p[k].s) {
                        for (int z = 1; z <= p[i].f; z++)
                        for (int h = 1; h <= p[i].s; h++)
                            c[z][h] = ch[i];
                        for (int z = p[i].f+1; z <= x; z++)
                        for (int h = 1; h <= p[i].s; h++)
                            c[z][h] = ch[j];
                        for (int z = 1; z <= x; z++)
                        for (int h = y+1; h <= p[k].s + y; h++)
                            c[z][h] = ch[k];
                        flag = true;
                        ans = x;
                        break;
                    }
                }
                if (x == p[k].s) {
                    if (x == y + p[k].f) {
                        for (int z = 1; z <= p[i].f; z++)
                        for (int h = 1; h <= p[i].s; h++)
                            c[z][h] = ch[i];
                        for (int z = p[i].f+1; z <= x; z++)
                        for (int h = 1; h <= p[i].s; h++)
                            c[z][h] = ch[j];
                        for (int z = 1; z <= x; z++)
                        for (int h = y+1; h <= p[k].f + y; h++)
                            c[z][h] = ch[k];
                        flag = true;
                        ans = x;
                        break;
                    }
                }
                if (y == p[k].f) {
                    if (y == p[k].s + x) {
                        for (int z = 1; z <= p[i].f; z++)
                        for (int h = 1; h <= p[i].s; h++)
                            c[z][h] = ch[i];
                        for (int z = p[i].f+1; z <= x; z++)
                        for (int h = 1; h <= p[i].s; h++)
                            c[z][h] = ch[j];
                        for (int z = x+1; z <= x + p[k].s; z++)
                        for (int h = 1; h <= y; h++)
                            c[z][h] = ch[k];
                        flag = true;
                        ans = y;
                        break;
                    }
                }
                if (y == p[k].s) {
                    if (y == x + p[k].f) {
                        for (int z = 1; z <= p[i].f; z++)
                        for (int h = 1; h <= p[i].s; h++)
                            c[z][h] = ch[i];
                        for (int z = p[i].f+1; z <= x; z++)
                        for (int h = 1; h <= p[i].s; h++)
                            c[z][h] = ch[j];
                        for (int z = x+1; z <= x + p[k].f; z++)
                        for (int h = 1; h <= y; h++)
                            c[z][h] = ch[k];
                        flag = true;
                        ans = y;
                        break;
                    }
                }
            }
            if (p[i].s == p[j].s) {
                x = p[i].f + p[j].f;
                y = p[i].s;
                if (x == p[k].f) {
                    if (x == y + p[k].s) {
                        for (int z = 1; z <= p[i].f; z++)
                        for (int h = 1; h <= p[i].s; h++)
                            c[z][h] = ch[i];
                        for (int z = p[i].f+1; z <= x; z++)
                        for (int h = 1; h <= p[i].s; h++)
                            c[z][h] = ch[j];
                        for (int z = 1; z <= x; z++)
                        for (int h = y+1; h <= p[k].s + y; h++)
                            c[z][h] = ch[k];
                        flag = true;
                        ans = x;
                        break;
                    }
                }
                if (x == p[k].s) {
                    if (x == y + p[k].f) {
                        for (int z = 1; z <= p[i].f; z++)
                        for (int h = 1; h <= p[i].s; h++)
                            c[z][h] = ch[i];
                        for (int z = p[i].f+1; z <= x; z++)
                        for (int h = 1; h <= p[i].s; h++)
                            c[z][h] = ch[j];
                        for (int z = 1; z <= x; z++)
                        for (int h = y+1; h <= p[k].f + y; h++)
                            c[z][h] = ch[k];
                        flag = true;
                        ans = x;
                        break;
                    }
                }
                if (y == p[k].f) {
                    if (y == p[k].s + x) {
                        for (int z = 1; z <= p[i].f; z++)
                        for (int h = 1; h <= p[i].s; h++)
                            c[z][h] = ch[i];
                        for (int z = p[i].f+1; z <= x; z++)
                        for (int h = 1; h <= p[i].s; h++)
                            c[z][h] = ch[j];
                        for (int z = x+1; z <= x + p[k].s; z++)
                        for (int h = 1; h <= y; h++)
                            c[z][h] = ch[k];
                        ans = y;
                        flag = true;
                        break;
                    }
                }
                if (y == p[k].s) {
                    if (y == x + p[k].f) {
                        for (int z = 1; z <= p[i].f; z++)
                        for (int h = 1; h <= p[i].s; h++)
                            c[z][h] = ch[i];
                        for (int z = p[i].f+1; z <= x; z++)
                        for (int h = 1; h <= p[i].s; h++)
                            c[z][h] = ch[j];
                        for (int z = x+1; z <= x + p[k].f; z++)
                        for (int h = 1; h <= y; h++)
                            c[z][h] = ch[k];
                        ans = y;
                        flag = true;
                        break;
                    }
                }
            }
        }
        if (flag) {
            cout << ans << endl;
            for (int i = 1; i <= ans; i++) {
                for (int j = 1; j <= ans; j++)
                    cout << c[i][j];
                cout << endl;
            }
        } else
            cout << -1;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
char mat[305][305];
bool cmpfnc(int a, int b){
return 10-(a%10)<10-(b%10);
}

int main(){
int x1,x2,x3,y1,y2,y3,ans, i, j, diff1, diff2;
cin>>x1>>y1>>x2>>y2>>x3>>y3;
ans=x1*y1+x2*y2+x3*y3;
double a=sqrt(ans);
//cout<<a<<endl;
double b;
b=ans-a*a;
//cout<<b<<endl;
if(b==0){
    ans=(int)a;
}
else{
    ans=-1;
}
if(ans==-1)
cout<<ans<<endl;
else{
    for(i=0;i<ans;i++)
    for(j=0;j<ans;j++)mat[i][j]='C';
    if(x1<y1)x1=x1+y1-(y1=x1);
    if(x2<y2)x2=x2+y2-(y2=x2);
    if(x3<y3)x3=x3+y3-(y3-x3);
    for(i=0;i<x1;i++){
        for(j=0;j<y1;j++){
            mat[i][j]='A';
        }
    }
    diff1=ans-x1;diff2=ans-y1;
    if(diff1>=x2){
        for(i=x1;i<x1+x2;i++){
            for(j=0;j<y2;j++){
                mat[i][j]='B';
            }
        }
    }
    else{
        if(diff2>=y2){
            for(i=0;i<x2;i++){
                for(j=y1;j<y1+y2;j++)
                    mat[i][j]='B';
            }
        }
    }
for(i=0;i<ans;i++)mat[i][ans]='\0';
cout<<ans<<endl;
for(i=0;i<ans;i++)printf("%s\n", mat[i]);
}
return 0;
}


import math
def main():
    t = int(input())
    out_lst = []
    if t <=100 and t >= 1:
        for i in range(t):
            n = int(input())
            div_n = n
            lst = []
            if(n < 300):
                n_rang = int(n / 2)
            else:
                n_rang = int(math.sqrt(int((math.sqrt(n)))))

            for j in range(2,n_rang):
                if div_n % j == 0:
                    div_n = div_n / j
                    lst.append(j)
                    if len(lst) == 2:
                        if(int(div_n) not in lst):
                            lst.append(int(div_n))
                        break
            if len(lst) == 3 and 1 not in lst:
                out_lst.append("YES")
                out_lst.append("{} {} {}".format(lst[0], lst[1], lst[2]))
            else:
                out_lst.append("NO")
        for k in out_lst:
            print(k)
    else:
        return False

main()


import math
def main():
    t = int(input())
    out_lst = []
    if t <=100 and t >= 1:
        for i in range(t):
            n = int(input())
            div_n = n
            lst = []
            n_rang = int(math.sqrt(math.sqrt(n)))
            for j in range(2,n_rang):
                if div_n % j == 0:
                    div_n = div_n / j
                    lst.append(j)
                    if len(lst) == 2:
                        if(int(div_n) not in lst):
                            lst.append(int(div_n))
                        break
            if len(lst) == 3 and 1 not in lst:
                out_lst.append("YES")
                out_lst.append("{} {} {}".format(lst[0], lst[1], lst[2]))
            else:
                out_lst.append("NO")
        for k in out_lst:
            print(k)
    else:
        return False

main()


def main():
    t = int(input())
    out_lst = []
    if t <=100 and t >= 1:
        for i in range (t):
            n = int(input())
            div_n = n;
            lst = []
            n_rang = n // 6
            for j in range(n_rang):
                if j > 1:
                    if div_n % j == 0:
                        div_n = div_n / j
                        lst.append(j)
                        if len(lst) == 2:
                            if(int(div_n) not in lst):
                                lst.append(int(div_n))
                            break
            if len(lst) == 3 and 1 not in lst:
                out_lst.append("YES")
                out_lst.append("{} {} {}".format(lst[0], lst[1], lst[2]))
            else:
                out_lst.append("NO")
        for k in out_lst:
            print(k)
    else:
        return False

main()


def main():
    t = int(input())
    out_lst = []
    if t <=100 and t >= 1:
        for i in range(t):
            n = int(input())
            div_n = n
            lst = []
            if n > 300:
                n_rang = n // 30
            else:
                n_rang = n // 6
            for j in range(2,n_rang):
                if div_n % j == 0:
                    div_n = div_n / j
                    lst.append(j)
                    if len(lst) == 2:
                        if(int(div_n) not in lst):
                            lst.append(int(div_n))
                        break
            if len(lst) == 3 and 1 not in lst:
                out_lst.append("YES")
                out_lst.append("{} {} {}".format(lst[0], lst[1], lst[2]))
            else:
                out_lst.append("NO")
        for k in out_lst:
            print(k)
    else:
        return False

main()


def main():
    t = int(input())
    out_lst = []
    if t <=100 and t >= 1:
        for i in range (t):
            n = int(input())
            div_n = n;
            lst = []
            for j in range(n//2):
                if j > 1:
                    if div_n % j == 0:
                        div_n = div_n / j
                        lst.append(j)
                        if len(lst) == 2:
                            if(int(div_n) not in lst):
                                lst.append(int(div_n))
                            break
            if len(lst) == 3 and 1 not in lst:
                out_lst.append("YES")
                out_lst.append("{} {} {}".format(lst[0],lst[1],lst[2]))
            else:
                out_lst.append("NO")
        for k in out_lst:
            print(k)
    else:
        return False

main()


import math
def main():
    t = int(input())
    out_lst = []
    if t <=100 and t >= 1:
        for i in range(t):
            n = int(input())
            div_n = n
            lst = []
            n_rang = int(math.sqrt(int((math.sqrt(n)))))
            if(n_rang > 2):
                for j in range(2,n_rang):
                    if div_n % j == 0:
                        div_n = div_n / j
                        lst.append(j)
                        if len(lst) == 2:
                            if(int(div_n) not in lst):
                                lst.append(int(div_n))
                            break
            if len(lst) == 3 and 1 not in lst:
                out_lst.append("YES")
                out_lst.append("{} {} {}".format(lst[0], lst[1], lst[2]))
            else:
                out_lst.append("NO")
        for k in out_lst:
            print(k)
    else:
        return False

main()


def factors(n):
    factor = []
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            factor.append(i)
    return factor

t = int(input())
for l in range(t):
    n = int(input())
    x = 0
    factor = factors(n)
    lenfactor = len(factor)
    for i in range(lenfactor):
        for j in range(i+1, lenfactor):
            k = n/(factor[i]*factor[j])
            if k%1 == 0 and k != factor[i] and k != factor[j]:
                print('YES')
                print(str(factor[i]) + ' ' + str(factor[j]) + ' ' + str(int(k))  )
                x = 1
                break
        if x == 1:
            break
    if x == 0:
        print('NO')


t = int(input())
for i in range(t):
    n = int(input())
    x = 0
    for j in range(2, int(n**(1/3)+1)):
        if n%j == 0:
            for k in range(j+1, int((n/j)**(1/2))):
                if n%(j*k) == 0 and n/(j*k) % 1 == 0 :
                    print('YES')
                    print(str(j) + ' ' + str(k) + ' ' + str(int(n/(j*k))) )
                    x = 1
                    break
            if x == 1:
                break
    print('NO') if x == 0 else None


t = int(input())
for i in range(t):
    n = int(input())
    x = 0
    for j in range(2, int(n/4)):
        if n % j == 0:
            for k in range(j+1, int(n/(j*2))):
                if n % k == 0:
                    l = n/(j*k)
                    if l % 1 == 0:
                        l = int(l)
                        if l != k and l != j:
                            print('YES')
                            print(str(j) + ' ' + str(k) + ' ' + str(l) )
                            x = 1
                            break
        if x == 1:
            break
    print('NO') if x == 0 else None


t = int(input())
for i in range(t):
    n = int(input())
    x = 0
    for j in range(2, int(n/3)):
        if n%j == 0:
            for k in range(j+1, int((n/j)/2)):
                if n%(j*k) == 0 and n/(j*k) % 1 == 0 and n/(j*k) != k :
                    print('YES')
                    print(str(j) + ' ' + str(k) + ' ' + str(int(n/(j*k))) )
                    x = 1
                    break
            if x == 1:
                break
    print('NO') if x == 0 else None


t = int(input())
for i in range(t):
    n = int(input())
    x = 0
    for j in range(2, int(n/4)):
        if n % j == 0:
            for k in range(j+1, int(n/(j*2))):
                if n % k == 0:
                    l = n/(j*k)
                    if l % 1 == 0:
                        l = int(l)
                        if l != k:
                            print('YES')
                            print(str(j) + ' ' + str(k) + ' ' + str(l) )
                            x = 1
                            break
        if x == 1:
            break
    print('NO') if x == 0 else None


t = int(input())
for _ in range(t):
    n = int(input())
    if n < 2*3*4:
        print("NO")
    else:
        r = []
        i = 2
        j = 3
        while j > 1:
            for k in range(i, int(n**(1/j) + 2)):
                if n % k == 0:
                    r.append(str(k))
                    n //= k
                    i += 1
                    j -= 1
            if len(r) == 0 or len(r) == 2:
                break
        if len(r) == 2 and n > int(r[-1]):
            r.append(str(n))
            print('YES')
            print(' '.join(r))
        else:
            print('NO')


t = int(input())
for _ in range(t):
    n = int(input())
    if n < 2*3*4:
        print("NO")
    else:
        r = []
        i = 2
        j = 3
        while j > 1:
            l = len(r)
            for k in range(i, int(n**(1/j) + 2)):
                if n % k == 0:
                    r.append(k)
                    n //= k
                    i = k + 1
                    j -= 1
                    break
            if len(r) == l or len(r) == 2:
                break
        if len(r) == 2 and n > int(r[-1]):
            r.append(n)
            print('YES')
            print(' '.join(map(str, r)))
        else:
            print('NO')


t = int(input())
for _ in range(t):
    n = int(input())
    if n < 2*3*4:
        print("NO")
    else:
        r = []
        i = 2
        j = 3
        for k in range(i, int(n**(1/j) + 2)):
            if n % k == 0:
                r.append(str(k))
                n //= k
                i += 1
                j -= 1
            if len(r) == 2:
                break
        if len(r) == 2 and n > int(r[-1]):
            r.append(str(n))
            print('YES')
            print(' '.join(r))
        else:
            print('NO')


t = int(input())
for _ in range(t):
    n = int(input())
    if n < 2*3*4:
        print("NO")
    else:
        r = []
        i = 2
        j = 3
        for k in range(i, int(n**(1/j) + 1)):
            if n % k == 0:
                r.append(str(k))
                n //= k
                i += 1
                j -= 1
            if len(r) >= 2:
                break
        if len(r) == 2 and (n != 1 and str(n) not in r):
            r.append(str(n))
            print('YES')
            print(' '.join(r))
        else:
            print('NO')


t = int(input())
for _ in range(t):
    n = int(input())
    r = []
    i = 2
    while n != 1:
        if len(r) == 2:
            break
        if n % i == 0:
            r.append(str(i))
            n //= i
        i += 1
    if len(r) == 2 and (n != 1 and str(n) not in r):
        r. append(str(n))
        print('YES')
        print(' '.join(r))
    else:
        print('NO')


t = int(input())
for _ in range(t):
    n = int(input())
    if n < 2*3*4:
        print("NO")
    else:
        r = []
        i = 2
        j = 3
        while j > 1:
            l = len(r)
            for k in range(i, int(n**(1/j) + 2)):
                if n % k == 0:
                    r.append(k)
                    n //= k
                    i = k + 1
                    j -= 1
            if len(r) == l or len(r) == 2:
                break

        if len(r) == 2 and n > int(r[-1]):
            r.append(n)
            print('YES')
            print(' '.join(map(str, r)))
        else:
            print('NO')


t = int(input())
for _ in range(t):
    n = int(input())
    if n < 2*3*4:
        print("NO")
    else:
        r = []
        i = 2
        j = 3
        for k in range(i, int(n**(1/j) + 2)):
            if n % k == 0:
                r.append(str(k))
                n //= k
                i += 1
                j -= 1
            if len(r) == 2 or j == 0:
                break
        if len(r) == 2 and n > int(r[-1]):
            r.append(str(n))
            print('YES')
            print(' '.join(r))
        else:
            print('NO')


t = int(input())
for _ in range(t):
    n = int(input())
    if n < 2*3*4:
        print("NO")
    else:
        r = []
        i = 2
        j = 3
        while j > 1:
            l = len(r)
            for k in range(i, int(n**(1/j) + 2)):
                if n % k == 0:
                    r.append(k)
                    n //= k
                    i += 1
                    j -= 1
            if len(r) == l or len(r) == 2:
                break

        if len(r) == 2 and n > int(r[-1]):
            r.append(n)
            print('YES')
            print(' '.join(map(str, r)))
        else:
            print('NO')


t = int(input())
for _ in range(t):
    n = int(input())
    if n < 2*3*4:
        print("NO")
    else:
        r = []
        i = 2
        j = 3
        for k in range(i, int(n**(1/j) + 2)):
            if n % k == 0:
                print(k)
                r.append(str(k))
                n //= k
                i += 1
                j -= 1
            if len(r) == 2 or j == 0:
                break
        if len(r) == 2 and n > int(r[1]):
            r.append(str(n))
            print('YES')
            print(' '.join(r))
        else:
            print('NO')


t = int(input())
for _ in range(t):
    n = int(input())
    if n < 2*3*4:
        print("NO")
    else:
        r = []
        i = 2
        j = 3
        while j > 1:
            for k in range(i, int(n**(1/j) + 2)):
                if n % k == 0:
                    r.append(str(k))
                    n //= k
                    i += 1
                    j -= 1
            if len(r) == 0:
                break
        if len(r) == 2 and n > int(r[-1]):
            r.append(str(n))
            print('YES')
            print(' '.join(r))
        else:
            print('NO')


import math

def primeFactors(n):
    d = {}

    while n % 2 == 0:
        try:
            d[2]+=1
        except:
            d[2]=1

        n = n // 2

    for i in range(3, int(math.sqrt(n))+1, 2):

        while n % i == 0:
            try:
                d[i]+=1
            except:
                d[i]=1
            n = n // i

    if n > 2:
        try:
            d[n]+=1
        except:
            d[n]=1

    return d

t=int(input())
while t:
    t-=1
    n=int(input())

    d=primeFactors(n)

    flag=0
    s=0
    toprint=[]

    if len(d)==1:
        for i in d:
            if d[i]>=6:
                flag=1
                toprint=[i,i**2,i**(d[i]-3)]

    elif len(d)>=3:
        flag=1
        cnt=0
        mul=1
        for i in d:
            if cnt==0:
                toprint.append(i)
            elif cnt==1:
                toprint.append(i)
            else:
                mul*=i
            cnt+=1
        toprint.append(mul)

    elif len(d)==2:
        keys=list(d.keys())
        if d[keys[0]]+d[keys[0]]>3:
            flag=1
            toprint=[keys[0],keys[1],(keys[0]**(d[keys[0]]-1))*(keys[1]**(d[keys[1]]-1))]

    if flag:
        print('YES')
        for i in toprint:
            print(i,end=' ')
        print()
    else:
        print('NO')


import math

def primeFactors(n):
    d = {}

    while n % 2 == 0:
        try:
            d[2]+=1
        except:
            d[2]=1

        n = n // 2

    for i in range(3, int(math.sqrt(n))+1, 2):

        while n % i == 0:
            try:
                d[i]+=1
            except:
                d[i]=1
            n = n // i

    if n > 2:
        try:
            d[n]+=1
        except:
            d[n]=1

    return d

t=int(input())
while t:
    t-=1
    n=int(input())

    d=primeFactors(n)
    # print(d)
    flag=0
    s=0
    toprint=[]

    if len(d)==1:
        for i in d:
            if d[i]>=6:
                flag=1
                toprint=[i,i**2,i**(d[i]-3)]

    elif len(d)>=3:
        flag=1
        cnt=0
        mul=1
        for i in d:
            if cnt==0:
                toprint.append(i**d[i])
            elif cnt==1:
                toprint.append(i**d[i])
            else:
                mul*=(i**d[i])
            cnt+=1
        toprint.append(mul)

    elif len(d)==2:
        keys=list(d.keys())
        if d[keys[0]]+d[keys[1]]>3:
            flag=1
            toprint=[keys[0],keys[1],(keys[0]**(d[keys[0]]-1))*(keys[1]**(d[keys[1]]-1))]

    if len(set(toprint))<3:
        flag=0
    if flag:
        print('YES')
        for i in toprint:
            print(i,end=' ')
        print()
    else:
        print('NO')


import math

def primeFactors(n):
    d = {}

    while n % 2 == 0:
        try:
            d[2]+=1
        except:
            d[2]=1

        n = n // 2

    for i in range(3, int(math.sqrt(n))+1, 2):

        while n % i == 0:
            try:
                d[i]+=1
            except:
                d[i]=1
            n = n // i

    if n > 2:
        try:
            d[n]+=1
        except:
            d[n]=1

    return d

t=int(input())
while t:
    t-=1
    n=int(input())

    d=primeFactors(n)
    # print(d)
    flag=0
    s=0
    toprint=[]

    if len(d)==1:
        for i in d:
            if d[i]>=6:
                flag=1
                toprint=[i,i**2,i**(d[i]-3)]

    elif len(d)>=3:
        flag=1
        cnt=0
        mul=1
        for i in d:
            if cnt==0:
                toprint.append(i**d[i])
            elif cnt==1:
                toprint.append(i**d[i])
            else:
                mul*=i
            cnt+=1
        toprint.append(mul)

    elif len(d)==2:
        keys=list(d.keys())
        if d[keys[0]]+d[keys[1]]>3:
            flag=1
            toprint=[keys[0],keys[1],(keys[0]**(d[keys[0]]-1))*(keys[1]**(d[keys[1]]-1))]

    if len(set(toprint))<3:
        flag=0
    if flag:
        print('YES')
        for i in toprint:
            print(i,end=' ')
        print()
    else:
        print('NO')


import math

def primeFactors(n):
    d = {}

    while n % 2 == 0:
        try:
            d[2]+=1
        except:
            d[2]=1

        n = n // 2

    for i in range(3, int(math.sqrt(n))+1, 2):

        while n % i == 0:
            try:
                d[i]+=1
            except:
                d[i]=1
            n = n // i

    if n > 2:
        try:
            d[n]+=1
        except:
            d[n]=1

    return d

t=int(input())
while t:
    t-=1
    n=int(input())

    d=primeFactors(n)

    flag=0
    s=0
    toprint=[]

    if len(d)==1:
        for i in d:
            if d[i]>=6:
                flag=1
                toprint=[i,i**2,i**(d[i]-3)]

    elif len(d)>=3:
        flag=1
        cnt=0
        mul=1
        for i in d:
            if cnt==0:
                toprint.append(i)
            elif cnt==1:
                toprint.append(i)
            else:
                mul*=i
            cnt+=1
        toprint.append(mul)

    elif len(d)==2:
        keys=list(d.keys())
        if d[keys[0]]+d[keys[0]]>3:
            flag=1
            toprint=[keys[0],keys[1],(keys[0]**(d[keys[0]]-1))*(keys[1]**(d[keys[1]]-1))]

    if len(set(toprint))<3:
        flag=0
    if flag:
        print('YES')
        for i in toprint:
            print(i,end=' ')
        print()
    else:
        print('NO')