#include <bits/stdc++.h>
using namespace std;
int len[3], width[3];
int Olen[3], Owidth[3];
string type = "ABC";
bool solve() {
  if (len[0] == len[1] and len[1] == len[2] and
      width[0] + width[1] + width[2] == len[0]) {
    printf("%d\n", len[0]);
    for (int i = 0; i < width[0]; i++, printf("\n"))
      for (int j = 0; j < len[0]; j++) printf("A");
    for (int i = 0; i < width[1]; i++, printf("\n"))
      for (int j = 0; j < len[0]; j++) printf("B");
    for (int i = 0; i < width[2]; i++, printf("\n"))
      for (int j = 0; j < len[0]; j++) printf("C");
    return true;
  }
  if (width[0] == width[1] and width[1] == width[2] and
      len[0] + len[1] + len[2] == width[0]) {
    printf("%d\n", width[0]);
    for (int i = 0; i < width[0]; i++, printf("\n")) {
      for (int j = 0; j < len[0]; j++) printf("A");
      for (int j = 0; j < len[1]; j++) printf("B");
      for (int j = 0; j < len[2]; j++) printf("C");
    }
    return true;
  }
  for (int i = 0; i < 3; i++)
    for (int j = 0; j < 3; j++)
      for (int k = 0; k < 3; k++) {
        if (i != j and i != k and j != k) {
          if (width[i] == width[j] and len[k] == len[i] + len[j] and
              width[i] + width[k] == len[k]) {
            printf("%d\n", len[k]);
            for (int ii = 0; ii < width[i]; ii++, printf("\n")) {
              for (int jj = 0; jj < len[i]; jj++) printf("%c", type[i]);
              for (int jj = 0; jj < len[j]; jj++) printf("%c", type[j]);
            }
            for (int ii = 0; ii < width[k]; ii++, printf("\n"))
              for (int jj = 0; jj < len[k]; jj++) printf("%c", type[k]);
            return true;
          }
        }
      }
  return false;
}
void rotate(int idx) { swap(len[idx], width[idx]); }
int main() {
  for (int i = 0; i < 3; i++) {
    cin >> Olen[i] >> Owidth[i];
  }
  for (int mask = 0; mask < (1 << 3); mask++) {
    for (int i = 0; i < 3; i++) len[i] = Olen[i], width[i] = Owidth[i];
    for (int i = 0; i < 3; i++) {
      if (mask & (1 << i)) rotate(i);
    }
    if (solve()) return 0;
  }
  printf("-1\n");
  return 0;
}
