#include <bits/stdc++.h>
using namespace std;
bool comp(int A, int B)
{
return A-(((A-1)/10)*10)<B-(((B-1)/10)*10);
}
int h[10000001];
int main() {
int area,x1,y1,x2,y2,x3,y3;
cin>>x1>>y1>>x2>>y2>>x3>>y3;
area=x1*y1+x2*y2+x3*y3;
int n=floor(sqrt(area)+0.5);
if(fabs(sqrt(area)-n)>1e-5)
{
cout<<"-1";
return 0;
}
if(x1==n)
{
if(x2==n-y1&&x3==n-y1&&y2+y3==n||x2==n-y1&&y3==n-y1&&y2+x3==n||y2==n-y1&&x3==n-y1&&x2+y3==n||y2==n-y1&&y3==n-y1&&x2+x3==n
||x2==n&&x3==n&&y2+y3==n-y1||y2==n&&x3==n&&x2+y3==n-y1||x2==n&&y3==n&&y2+x3==n-y1||y2==n&&y3==n&&x2+x3==n-y1)
cout<<n<<endl;
else
{
cout<<"-1";
return 0;
}
for(int i=0;i<y1;i++)
{
for(int j=0;j<n;j++)
cout<<"A";
cout<<"\n";
}
if(x2==n-y1&&x3==n-y1&&y2+y3==n)
{
for(int j=0;j<n-y1;j++)
{
for(int i=0;i<y2;i++)
cout<<"B";
for(int i=0;i<y3;i++)
cout<<"C";
cout<<endl;
}
}
else
if(x2==n-y1&&y3==n-y1&&y2+x3==n)
{
int temp=x3;
x3=y3;
y3=temp;
for(int j=0;j<n-y1;j++)
{
for(int i=0;i<y2;i++)
cout<<"B";
for(int i=0;i<y3;i++)
cout<<"C";
cout<<endl;
}
}
else
if(y2==n-y1&&x3==n-y1&&x2+y3==n)
{
int temp=x2;
x2=y2;
y2=temp;
for(int j=0;j<n-y1;j++)
{
for(int i=0;i<y2;i++)
cout<<"B";
for(int i=0;i<y3;i++)
cout<<"C";
cout<<endl;
}
}
else
if(y2==n-y1&&y3==n-y1&&x2+x3==n)
{
int temp=x2;
x2=y2;
y2=temp;
temp=x3;
x3=y3;
y3=temp;
for(int j=0;j<n-y1;j++)
{
for(int i=0;i<y2;i++)
cout<<"B";
for(int i=0;i<y3;i++)
cout<<"C";
cout<<endl;
}
}
if(x2==n&&x3==n&&y2+y3==n-y1)
{
for(int j=0;j<y2;j++)
{
for(int i=0;i<n;i++)
cout<<"B";
cout<<"\n";
}
for(int j=0;j<y3;j++)
{
for(int i=0;i<n;i++)
cout<<"C";
cout<<"\n";
}
}
else
if(x2==n&&y3==n&&y2+x3==n-y1)
{
int temp=x3;
x3=y3;
y3=temp;
for(int j=0;j<y2;j++)
{
for(int i=0;i<n;i++)
cout<<"B";
cout<<"\n";
}
for(int j=0;j<y3;j++)
{
for(int i=0;i<n;i++)
cout<<"C";
cout<<"\n";
}
}
else
if(y2==n&&x3==n&&x2+y3==n-y1)
{
int temp=x2;
x2=y2;
y2=temp;
for(int j=0;j<y2;j++)
{
for(int i=0;i<n;i++)
cout<<"B";
cout<<"\n";
}
for(int j=0;j<y3;j++)
{
for(int i=0;i<n;i++)
cout<<"C";
cout<<"\n";
}
}
else
if(y2==n&&y3==n&&x2+x3==n-y1)
{
int temp=x2;
x2=y2;
y2=temp;
temp=x3;
x3=y3;
y3=temp;
for(int j=0;j<y2;j++)
{
for(int i=0;i<n;i++)
cout<<"B";
cout<<"\n";
}
for(int j=0;j<y3;j++)
{
for(int i=0;i<n;i++)
cout<<"C";
cout<<"\n";
}
}
}
else
if(y1==n)
{
int tempo=x1;
x1=y1;
y1=tempo;
if(x2==n-y1&&x3==n-y1&&y2+y3==n||x2==n-y1&&y3==n-y1&&y2+x3==n||y2==n-y1&&x3==n-y1&&x2+y3==n||y2==n-y1&&y3==n-y1&&x2+x3==n
||x2==n&&x3==n&&y2+y3==n-y1||y2==n&&x3==n&&x2+y3==n-y1||x2==n&&y3==n&&y2+x3==n-y1||y2==n&&y3==n&&x2+x3==n-y1)
cout<<n<<endl;
else
{
cout<<"-1";
return 0;
}
for(int i=0;i<y1;i++)
{
for(int j=0;j<n;j++)
cout<<"A";
cout<<"\n";
}
if(x2==n-y1&&x3==n-y1&&y2+y3==n)
{
for(int j=0;j<n-y1;j++)
{
for(int i=0;i<y2;i++)
cout<<"B";
for(int i=0;i<y3;i++)
cout<<"C";
cout<<endl;
}
}
else
if(x2==n-y1&&y3==n-y1&&y2+x3==n)
{
int temp=x3;
x3=y3;
y3=temp;
for(int j=0;j<n-y1;j++)
{
for(int i=0;i<y2;i++)
cout<<"B";
for(int i=0;i<y3;i++)
cout<<"C";
cout<<endl;
}
}
else
if(y2==n-y1&&x3==n-y1&&x2+y3==n)
{
int temp=x2;
x2=y2;
y2=temp;
for(int j=0;j<n-y1;j++)
{
for(int i=0;i<y2;i++)
cout<<"B";
for(int i=0;i<y3;i++)
cout<<"C";
cout<<endl;
}
}
else
if(y2==n-y1&&y3==n-y1&&x2+x3==n)
{
int temp=x2;
x2=y2;
y2=temp;
temp=x3;
x3=y3;
y3=temp;
for(int j=0;j<n-y1;j++)
{
for(int i=0;i<y2;i++)
cout<<"B";
for(int i=0;i<y3;i++)
cout<<"C";
cout<<endl;
}
}
if(x2==n&&x3==n&&y2+y3==n-y1)
{
for(int j=0;j<y2;j++)
{
for(int i=0;i<n;i++)
cout<<"B";
cout<<"\n";
}
for(int j=0;j<y3;j++)
{
for(int i=0;i<n;i++)
cout<<"C";
cout<<"\n";
}
}
else
if(x2==n&&y3==n&&y2+x3==n-y1)
{
int temp=x3;
x3=y3;
y3=temp;
for(int j=0;j<y2;j++)
{
for(int i=0;i<n;i++)
cout<<"B";
cout<<"\n";
}
for(int j=0;j<y3;j++)
{
for(int i=0;i<n;i++)
cout<<"C";
cout<<"\n";
}
}
else
if(y2==n&&x3==n&&x2+y3==n-y1)
{
int temp=x2;
x2=y2;
y2=temp;
for(int j=0;j<y2;j++)
{
for(int i=0;i<n;i++)
cout<<"B";
cout<<"\n";
}
for(int j=0;j<y3;j++)
{
for(int i=0;i<n;i++)
cout<<"C";
cout<<"\n";
}
}
else
if(y2==n&&y3==n&&x2+x3==n-y1)
{
int temp=x2;
x2=y2;
y2=temp;
temp=x3;
x3=y3;
y3=temp;
for(int j=0;j<y2;j++)
{
for(int i=0;i<n;i++)
cout<<"B";
cout<<"\n";
}
for(int j=0;j<y3;j++)
{
for(int i=0;i<n;i++)
cout<<"C";
cout<<"\n";
}
}
}
else
if(x2==n)
{
int tempo=x2;
x2=x1;
x1=tempo;
tempo=y2;
y2=y1;
y1=tempo;
if(x2==n-y1&&x3==n-y1&&y2+y3==n||x2==n-y1&&y3==n-y1&&y2+x3==n||y2==n-y1&&x3==n-y1&&x2+y3==n||y2==n-y1&&y3==n-y1&&x2+x3==n
||x2==n&&x3==n&&y2+y3==n-y1||y2==n&&x3==n&&x2+y3==n-y1||x2==n&&y3==n&&y2+x3==n-y1||y2==n&&y3==n&&x2+x3==n-y1)
cout<<n<<endl;
else
{
cout<<"-1";
return 0;
}
for(int i=0;i<y1;i++)
{
for(int j=0;j<n;j++)
cout<<"B";
cout<<"\n";
}
if(x2==n-y1&&x3==n-y1&&y2+y3==n)
{
for(int j=0;j<n-y1;j++)
{
for(int i=0;i<y2;i++)
cout<<"A";
for(int i=0;i<y3;i++)
cout<<"C";
cout<<endl;
}
}
else
if(x2==n-y1&&y3==n-y1&&y2+x3==n)
{
int temp=x3;
x3=y3;
y3=temp;
for(int j=0;j<n-y1;j++)
{
for(int i=0;i<y2;i++)
cout<<"A";
for(int i=0;i<y3;i++)
cout<<"C";
cout<<endl;
}
}
else
if(y2==n-y1&&x3==n-y1&&x2+y3==n)
{
int temp=x2;
x2=y2;
y2=temp;
for(int j=0;j<n-y1;j++)
{
for(int i=0;i<y2;i++)
cout<<"A";
for(int i=0;i<y3;i++)
cout<<"C";
cout<<endl;
}
}
else
if(y2==n-y1&&y3==n-y1&&x2+x3==n)
{
int temp=x2;
x2=y2;
y2=temp;
temp=x3;
x3=y3;
y3=temp;
for(int j=0;j<n-y1;j++)
{
for(int i=0;i<y2;i++)
cout<<"A";
for(int i=0;i<y3;i++)
cout<<"C";
cout<<endl;
}
}
if(x2==n&&x3==n&&y2+y3==n-y1)
{
for(int j=0;j<y2;j++)
{
for(int i=0;i<n;i++)
cout<<"A";
cout<<"\n";
}
for(int j=0;j<y3;j++)
{
for(int i=0;i<n;i++)
cout<<"C";
cout<<"\n";
}
}
else
if(x2==n&&y3==n&&y2+x3==n-y1)
{
int temp=x3;
x3=y3;
y3=temp;
for(int j=0;j<y2;j++)
{
for(int i=0;i<n;i++)
cout<<"A";
cout<<"\n";
}
for(int j=0;j<y3;j++)
{
for(int i=0;i<n;i++)
cout<<"C";
cout<<"\n";
}
}
else
if(y2==n&&x3==n&&x2+y3==n-y1)
{
int temp=x2;
x2=y2;
y2=temp;
for(int j=0;j<y2;j++)
{
for(int i=0;i<n;i++)
cout<<"A";
cout<<"\n";
}
for(int j=0;j<y3;j++)
{
for(int i=0;i<n;i++)
cout<<"C";
cout<<"\n";
}
}
else
if(y2==n&&y3==n&&x2+x3==n-y1)
{
int temp=x2;
x2=y2;
y2=temp;
temp=x3;
x3=y3;
y3=temp;
for(int j=0;j<y2;j++)
{
for(int i=0;i<n;i++)
cout<<"A";
cout<<"\n";
}
for(int j=0;j<y3;j++)
{
for(int i=0;i<n;i++)
cout<<"C";
cout<<"\n";
}
}
}
else
if(y2==n)
{
int temp=y2;
y2=x2;
x2=temp;
int tempo=x2;
x2=x1;
x1=tempo;
tempo=y2;
y2=y1;
y1=tempo;
if(x2==n-y1&&x3==n-y1&&y2+y3==n||x2==n-y1&&y3==n-y1&&y2+x3==n||y2==n-y1&&x3==n-y1&&x2+y3==n||y2==n-y1&&y3==n-y1&&x2+x3==n
||x2==n&&x3==n&&y2+y3==n-y1||y2==n&&x3==n&&x2+y3==n-y1||x2==n&&y3==n&&y2+x3==n-y1||y2==n&&y3==n&&x2+x3==n-y1)
cout<<n<<endl;
else
{
cout<<"-1";
return 0;
}
for(int i=0;i<y1;i++)
{
for(int j=0;j<n;j++)
cout<<"B";
cout<<"\n";
}
if(x2==n-y1&&x3==n-y1&&y2+y3==n)
{
for(int j=0;j<n-y1;j++)
{
for(int i=0;i<y2;i++)
cout<<"A";
for(int i=0;i<y3;i++)
cout<<"C";
cout<<endl;
}
}
else
if(x2==n-y1&&y3==n-y1&&y2+x3==n)
{
int temp=x3;
x3=y3;
y3=temp;
for(int j=0;j<n-y1;j++)
{
for(int i=0;i<y2;i++)
cout<<"A";
for(int i=0;i<y3;i++)
cout<<"C";
cout<<endl;
}
}
else
if(y2==n-y1&&x3==n-y1&&x2+y3==n)
{
int temp=x2;
x2=y2;
y2=temp;
for(int j=0;j<n-y1;j++)
{
for(int i=0;i<y2;i++)
cout<<"A";
for(int i=0;i<y3;i++)
cout<<"C";
cout<<endl;
}
}
else
if(y2==n-y1&&y3==n-y1&&x2+x3==n)
{
int temp=x2;
x2=y2;
y2=temp;
temp=x3;
x3=y3;
y3=temp;
for(int j=0;j<n-y1;j++)
{
for(int i=0;i<y2;i++)
cout<<"A";
for(int i=0;i<y3;i++)
cout<<"C";
cout<<endl;
}
}
if(x2==n&&x3==n&&y2+y3==n-y1)
{
for(int j=0;j<y2;j++)
{
for(int i=0;i<n;i++)
cout<<"A";
cout<<"\n";
}
for(int j=0;j<y3;j++)
{
for(int i=0;i<n;i++)
cout<<"C";
cout<<"\n";
}
}
else
if(x2==n&&y3==n&&y2+x3==n-y1)
{
int temp=x3;
x3=y3;
y3=temp;
for(int j=0;j<y2;j++)
{
for(int i=0;i<n;i++)
cout<<"A";
cout<<"\n";
}
for(int j=0;j<y3;j++)
{
for(int i=0;i<n;i++)
cout<<"C";
cout<<"\n";
}
}
else
if(y2==n&&x3==n&&x2+y3==n-y1)
{
int temp=x2;
x2=y2;
y2=temp;
for(int j=0;j<y2;j++)
{
for(int i=0;i<n;i++)
cout<<"A";
cout<<"\n";
}
for(int j=0;j<y3;j++)
{
for(int i=0;i<n;i++)
cout<<"C";
cout<<"\n";
}
}
else
if(y2==n&&y3==n&&x2+x3==n-y1)
{
int temp=x2;
x2=y2;
y2=temp;
temp=x3;
x3=y3;
y3=temp;
for(int j=0;j<y2;j++)
{
for(int i=0;i<n;i++)
cout<<"A";
cout<<"\n";
}
for(int j=0;j<y3;j++)
{
for(int i=0;i<n;i++)
cout<<"C";
cout<<"\n";
}
}
}
else
if(x3==n)
{
int tempo=x3;
x3=x1;
x1=tempo;
tempo=y3;
y3=y1;
y1=tempo;
if(x2==n-y1&&x3==n-y1&&y2+y3==n||x2==n-y1&&y3==n-y1&&y2+x3==n||y2==n-y1&&x3==n-y1&&x2+y3==n||y2==n-y1&&y3==n-y1&&x2+x3==n
||x2==n&&x3==n&&y2+y3==n-y1||y2==n&&x3==n&&x2+y3==n-y1||x2==n&&y3==n&&y2+x3==n-y1||y2==n&&y3==n&&x2+x3==n-y1)
cout<<n<<endl;
else
{
cout<<"-1";
return 0;
}
for(int i=0;i<y1;i++)
{
for(int j=0;j<n;j++)
cout<<"C";
cout<<"\n";
}
if(x2==n-y1&&x3==n-y1&&y2+y3==n)
{
for(int j=0;j<n-y1;j++)
{
for(int i=0;i<y2;i++)
cout<<"B";
for(int i=0;i<y3;i++)
cout<<"A";
cout<<endl;
}
}
else
if(x2==n-y1&&y3==n-y1&&y2+x3==n)
{
int temp=x3;
x3=y3;
y3=temp;
for(int j=0;j<n-y1;j++)
{
for(int i=0;i<y2;i++)
cout<<"B";
for(int i=0;i<y3;i++)
cout<<"A";
cout<<endl;
}
}
else
if(y2==n-y1&&x3==n-y1&&x2+y3==n)
{
int temp=x2;
x2=y2;
y2=temp;
for(int j=0;j<n-y1;j++)
{
for(int i=0;i<y2;i++)
cout<<"B";
for(int i=0;i<y3;i++)
cout<<"A";
cout<<endl;
}
}
else
if(y2==n-y1&&y3==n-y1&&x2+x3==n)
{
int temp=x2;
x2=y2;
y2=temp;
temp=x3;
x3=y3;
y3=temp;
for(int j=0;j<n-y1;j++)
{
for(int i=0;i<y2;i++)
cout<<"B";
for(int i=0;i<y3;i++)
cout<<"A";
cout<<endl;
}
}
if(x2==n&&x3==n&&y2+y3==n-y1)
{
for(int j=0;j<y2;j++)
{
for(int i=0;i<n;i++)
cout<<"B";
cout<<"\n";
}
for(int j=0;j<y3;j++)
{
for(int i=0;i<n;i++)
cout<<"A";
cout<<"\n";
}
}
else
if(x2==n&&y3==n&&y2+x3==n-y1)
{
int temp=x3;
x3=y3;
y3=temp;
for(int j=0;j<y2;j++)
{
for(int i=0;i<n;i++)
cout<<"B";
cout<<"\n";
}
for(int j=0;j<y3;j++)
{
for(int i=0;i<n;i++)
cout<<"A";
cout<<"\n";
}
}
else
if(y2==n&&x3==n&&x2+y3==n-y1)
{
int temp=x2;
x2=y2;
y2=temp;
for(int j=0;j<y2;j++)
{
for(int i=0;i<n;i++)
cout<<"B";
cout<<"\n";
}
for(int j=0;j<y3;j++)
{
for(int i=0;i<n;i++)
cout<<"A";
cout<<"\n";
}
}
else
if(y2==n&&y3==n&&x2+x3==n-y1)
{
int temp=x2;
x2=y2;
y2=temp;
temp=x3;
x3=y3;
y3=temp;
for(int j=0;j<y2;j++)
{
for(int i=0;i<n;i++)
cout<<"B";
cout<<"\n";
}
for(int j=0;j<y3;j++)
{
for(int i=0;i<n;i++)
cout<<"A";
cout<<"\n";
}
}
}
else
if(y3==n)
{
int temp=y3;
y3=x3;
x3=temp;
int tempo=x3;
x3=x1;
x1=tempo;
tempo=y3;
y3=y1;
y1=tempo;
if(x2==n-y1&&x3==n-y1&&y2+y3==n||x2==n-y1&&y3==n-y1&&y2+x3==n||y2==n-y1&&x3==n-y1&&x2+y3==n||y2==n-y1&&y3==n-y1&&x2+x3==n
||x2==n&&x3==n&&y2+y3==n-y1||y2==n&&x3==n&&x2+y3==n-y1||x2==n&&y3==n&&y2+x3==n-y1||y2==n&&y3==n&&x2+x3==n-y1)
cout<<n<<endl;
else
{
cout<<"-1";
return 0;
}
for(int i=0;i<y1;i++)
{
for(int j=0;j<n;j++)
cout<<"C";
cout<<"\n";
}
if(x2==n-y1&&x3==n-y1&&y2+y3==n)
{
for(int j=0;j<n-y1;j++)
{
for(int i=0;i<y2;i++)
cout<<"B";
for(int i=0;i<y3;i++)
cout<<"A";
cout<<endl;
}
}
else
if(x2==n-y1&&y3==n-y1&&y2+x3==n)
{
int temp=x3;
x3=y3;
y3=temp;
for(int j=0;j<n-y1;j++)
{
for(int i=0;i<y2;i++)
cout<<"B";
for(int i=0;i<y3;i++)
cout<<"A";
cout<<endl;
}
}
else
if(y2==n-y1&&x3==n-y1&&x2+y3==n)
{
int temp=x2;
x2=y2;
y2=temp;
for(int j=0;j<n-y1;j++)
{
for(int i=0;i<y2;i++)
cout<<"B";
for(int i=0;i<y3;i++)
cout<<"A";
cout<<endl;
}
}
else
if(y2==n-y1&&y3==n-y1&&x2+x3==n)
{
int temp=x2;
x2=y2;
y2=temp;
temp=x3;
x3=y3;
y3=temp;
for(int j=0;j<n-y1;j++)
{
for(int i=0;i<y2;i++)
cout<<"B";
for(int i=0;i<y3;i++)
cout<<"A";
cout<<endl;
}
}
if(x2==n&&x3==n&&y2+y3==n-y1)
{
for(int j=0;j<y2;j++)
{
for(int i=0;i<n;i++)
cout<<"B";
cout<<"\n";
}
for(int j=0;j<y3;j++)
{
for(int i=0;i<n;i++)
cout<<"A";
cout<<"\n";
}
}
else
if(x2==n&&y3==n&&y2+x3==n-y1)
{
int temp=x3;
x3=y3;
y3=temp;
for(int j=0;j<y2;j++)
{
for(int i=0;i<n;i++)
cout<<"B";
cout<<"\n";
}
for(int j=0;j<y3;j++)
{
for(int i=0;i<n;i++)
cout<<"A";
cout<<"\n";
}
}
else
if(y2==n&&x3==n&&x2+y3==n-y1)
{
int temp=x2;
x2=y2;
y2=temp;
for(int j=0;j<y2;j++)
{
for(int i=0;i<n;i++)
cout<<"B";
cout<<"\n";
}
for(int j=0;j<y3;j++)
{
for(int i=0;i<n;i++)
cout<<"A";
cout<<"\n";
}
}
else
if(y2==n&&y3==n&&x2+x3==n-y1)
{
int temp=x2;
x2=y2;
y2=temp;
temp=x3;
x3=y3;
y3=temp;
for(int j=0;j<y2;j++)
{
for(int i=0;i<n;i++)
cout<<"B";
cout<<"\n";
}
for(int j=0;j<y3;j++)
{
for(int i=0;i<n;i++)
cout<<"A";
cout<<"\n";
}
}
}
else
{
cout<<"-1";
return 0;
}
}