#include <bits/stdc++.h>
using namespace std;
const int dx[] = {-1, 1, 0, 0};
const int dy[] = {0, 0, -1, 1};
string s[6];
char mp[40][40];
char res[40][40];
int rx, ry;
int Size(char buf[40][40]) {
  ry = 0;
  for (int i = 0; i < 40; i++)
    for (int j = 0; j < 40; j++)
      if (isupper(buf[i][j])) ry = max(j, ry);
  return ry;
}
bool better() {
  int sz1 = Size(mp);
  int sz2 = Size(res);
  for (int i = 0; i < 40; i++) {
    for (int j = 0; j < 40; j++)
      if (mp[i][j] != res[i][j]) return mp[i][j] < res[i][j];
    if (sz1 != sz2) return sz1 < sz2;
  }
  return false;
}
bool In(int x, int y) { return x >= 0 && x < 40 && y >= 0 && y < 40; }
bool check() {
  for (int i = 0; i < 40; i++)
    for (int j = 0; j < 40; j++) {
      int cnt = 0;
      if (!isupper(mp[i][j])) continue;
      for (int d = 0; d < 4; d++) {
        int x = i + dx[d];
        int y = j + dy[d];
        if (!In(x, y)) continue;
        if (isupper(mp[x][y])) cnt++;
      }
      if ((cnt & 1) != 0) return false;
    }
  return true;
}
void Fill(string str, bool dirc, int sx, int sy) {
  if (dirc == 0)
    for (int i = sx; i < sx + str.size(); i++) mp[i][sy] = str[i - sx];
  else
    for (int i = sy; i < sy + str.size(); i++) mp[sx][i] = str[i - sy];
}
bool can(string str, bool dirc, int sx, int sy) {
  if (dirc == 0) {
    for (int i = sx; i < sx + str.size(); i++)
      if (!In(i, sy) || (isupper(mp[i][sy]) && mp[i][sy] != str[i - sx]))
        return false;
  } else {
    for (int i = sy; i < sy + str.size(); i++)
      if (!In(sx, i) || (isupper(mp[sx][i]) && mp[sx][i] != str[i - sy]))
        return false;
  }
  return true;
}
void Print() {
  rx = 0;
  ry = 0;
  for (int i = 0; i < 40; i++)
    for (int j = 0; j < 40; j++) {
      if (isupper(res[i][j])) {
        rx = max(i, rx);
        ry = max(j, ry);
      }
      if (res[i][j] == 'a') {
        puts("Impossible");
        exit(0);
      }
    }
  for (int i = 0; i < rx + 1; i++) {
    for (int j = 0; j < ry + 1; j++) putchar(res[i][j]);
    putchar('\n');
  }
}
void Solve() {
  memset(res, 'a', sizeof(res));
  do {
    memset(mp, '.', sizeof(mp));
    int x1 = 0, y1 = 0;
    if (can(s[0], 0, x1, y1))
      Fill(s[0], 0, x1, y1);
    else
      continue;
    x1 += s[0].size() - 1;
    if (can(s[1], 1, x1, y1))
      Fill(s[1], 1, x1, y1);
    else
      continue;
    y1 += s[1].size() - 1;
    if (can(s[2], 0, x1, y1))
      Fill(s[2], 0, x1, y1);
    else
      continue;
    int x2 = 0, y2 = 0;
    if (can(s[3], 1, x2, y2))
      Fill(s[3], 1, x2, y2);
    else
      continue;
    y2 += s[3].size() - 1;
    if (can(s[4], 0, x2, y2))
      Fill(s[4], 0, x2, y2);
    else
      continue;
    x2 += s[4].size() - 1;
    if (can(s[5], 1, x2, y2))
      Fill(s[5], 1, x2, y2);
    else
      continue;
    if (check())
      if (better())
        for (int i = 0; i < 40; i++)
          for (int j = 0; j < 40; j++) res[i][j] = mp[i][j];
  } while (next_permutation(s, s + 6));
}
int main() {
  for (int i = 0; i < 6; i++) cin >> s[i];
  sort(s, s + 6);
  Solve();
  Print();
  return 0;
}
