#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 lx = 0x3f3f3f3f, ly = 0x3f3f3f3f, rx, ry;
int a[6];
bool b[6];
int Size(char buf[40][40]) {
  lx = 0x3f3f3f3f;
  ly = 0x3f3f3f3f;
  rx = 0;
  ry = 0;
  for (int i = 0; i < 40; i++)
    for (int j = 0; j < 40; j++) {
      if (isupper(buf[i][j])) {
        lx = min(i, lx);
        ly = min(j, ly);
        rx = max(i, rx);
        ry = max(j, ry);
      }
    }
  return ry;
}
bool better() {
  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 (Size(mp) != Size(res)) return Size(mp) < Size(res);
  }
  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 % 2 != 0) return false;
    }
  return true;
}
void Fill(string str, int dirc, int sx, int sy) {
  if (dirc == 0) {
    for (int i = sx; i >= sx - str.size() + 1; i--) {
      char &c = mp[i][sy];
      c = str[sx - i];
    }
  } else if (dirc == 1) {
    for (int i = sx; i < sx + str.size(); i++) {
      char &c = mp[i][sy];
      c = str[i - sx];
    }
  } else if (dirc == 2) {
    for (int i = sy; i >= sy - str.size() + 1; i--) {
      char &c = mp[sx][i];
      c = str[sy - i];
    }
  } else {
    for (int i = sy; i < sy + str.size(); i++) {
      char &c = mp[sx][i];
      c = str[i - sy];
    }
  }
}
bool can(string str, int dirc, int sx, int sy) {
  if (dirc == 0) {
    for (int i = sx; i >= sx - str.size() + 1; i--) {
      if (!In(i, sy)) return false;
      char c = mp[i][sy];
      if (isupper(c) && c != str[sx - i]) return false;
    }
  } else if (dirc == 1) {
    for (int i = sx; i < sx + str.size(); i++) {
      if (!In(i, sy)) return false;
      char c = mp[i][sy];
      if (isupper(c) && c != str[i - sx]) return false;
    }
  } else if (dirc == 2) {
    for (int i = sy; i >= sy - str.size() + 1; i--) {
      if (!In(sx, i)) return false;
      char c = mp[sx][i];
      if (isupper(c) && c != str[sy - i]) return false;
    }
  } else {
    for (int i = sy; i < sy + str.size(); i++) {
      if (!In(sx, i)) return false;
      char c = mp[sx][i];
      if (isupper(c) && c != str[i - sy]) return false;
    }
  }
  return true;
}
void Print() {
  lx = 0x3f3f3f3f;
  ly = 0x3f3f3f3f;
  rx = 0;
  ry = 0;
  for (int i = 0; i < 40; i++)
    for (int j = 0; j < 40; j++) {
      if (isupper(res[i][j])) {
        lx = min(i, lx);
        ly = min(j, ly);
        rx = max(i, rx);
        ry = max(j, ry);
      }
      if (res[i][j] == 'a') {
        puts("Impossible");
        exit(0);
      }
    }
  for (int i = lx; i < rx + 1; i++) {
    for (int j = ly; j < ry + 1; j++) putchar(res[i][j]);
    putchar('\n');
  }
}
void dfs(int k) {
  if (k == 6) {
    memset(mp, '.', sizeof(mp));
    int x2782764 = 0, y1284628462 = 0;
    if (can(s[a[0]], 1, x2782764, y1284628462))
      Fill(s[a[0]], 1, x2782764, y1284628462);
    else
      return;
    x2782764 += s[a[0]].size() - 1;
    if (can(s[a[1]], 3, x2782764, y1284628462))
      Fill(s[a[1]], 3, x2782764, y1284628462);
    else
      return;
    y1284628462 += s[a[1]].size() - 1;
    if (can(s[a[2]], 1, x2782764, y1284628462))
      Fill(s[a[2]], 1, x2782764, y1284628462);
    else
      return;
    int x258365 = 0, y78246583 = 0;
    if (can(s[a[3]], 3, x258365, y78246583))
      Fill(s[a[3]], 3, x258365, y78246583);
    else
      return;
    y78246583 += s[a[3]].size() - 1;
    if (can(s[a[4]], 1, x258365, y78246583))
      Fill(s[a[4]], 1, x258365, y78246583);
    else
      return;
    x258365 += s[a[4]].size() - 1;
    if (can(s[a[5]], 3, x258365, y78246583))
      Fill(s[a[5]], 3, x258365, y78246583);
    else
      return;
    if (check())
      if (better())
        for (int i = 0; i < 40; i++)
          for (int j = 0; j < 40; j++) res[i][j] = mp[i][j];
    return;
  }
  for (int i = 0; i < 6; i++) {
    if (!b[i]) {
      a[k] = i;
      b[i] = true;
      dfs(k + 1);
      b[i] = false;
    }
  }
}
void Init() {
  for (int i = 0; i < 6; i++) cin >> s[i];
  sort(s, s + 6);
  memset(res, 'a', sizeof(res));
}
int main() {
  Init();
  dfs(0);
  Print();
  return 0;
}
