#include <bits/stdc++.h>
using namespace std;
const long long M = 1e9 + 7;
const long long INF = 1e9;
inline long long pwr(long long base, long long n, long long m) {
  long long ans = 1;
  while (n > 0) {
    if (n % 2 == 1) ans = (ans * base) % m;
    base = (base * base) % m;
    n /= 2;
  }
  return ans;
}
string s[6];
string ans = "";
char res[35][35], r1[35][35];
void comp(string s1) {
  int col = s[s1[1] - '0'].length();
  int row = s[s1[4] - '0'].length();
  int l0 = s[s1[0] - '0'].length();
  int l1 = s[s1[1] - '0'].length();
  int l2 = s[s1[2] - '0'].length();
  int l3 = s[s1[3] - '0'].length();
  int l4 = s[s1[4] - '0'].length();
  int l5 = s[s1[5] - '0'].length();
  if (ans.length() == 0) {
    ans = s1;
    for (int i = 0; i < l0; i++) res[0][i] = s[s1[0] - '0'][i];
    for (int i = 0; i < l1; i++) res[l3 - 1][i] = s[s1[1] - '0'][i];
    for (int i = 0; i < l2; i++) res[l4 - 1][i + l0 - 1] = s[s1[2] - '0'][i];
    for (int i = 0; i < l3; i++) res[i][0] = s[s1[3] - '0'][i];
    for (int i = 0; i < l4; i++) res[i][l0 - 1] = s[s1[4] - '0'][i];
    for (int i = 0; i < l5; i++) res[i + l3 - 1][col - 1] = s[s1[5] - '0'][i];
    for (int i = row; i < 32; i++) {
      for (int j = 0; j < 32; j++) {
        res[i][j] = '.' - 1;
      }
    }
    for (int i = 0; i < 32; i++) {
      for (int j = col; j < 32; j++) {
        res[i][j] = '.' - 1;
      }
    }
    return;
  }
  for (int i = 0; i < 32; i++)
    for (int j = 0; j < 32; j++) r1[i][j] = '.';
  for (int i = 0; i < l0; i++) r1[0][i] = s[s1[0] - '0'][i];
  for (int i = 0; i < l1; i++) r1[l3 - 1][i] = s[s1[1] - '0'][i];
  for (int i = 0; i < l2; i++) r1[l4 - 1][i + l0 - 1] = s[s1[2] - '0'][i];
  for (int i = 0; i < l3; i++) r1[i][0] = s[s1[3] - '0'][i];
  for (int i = 0; i < l4; i++) r1[i][l0 - 1] = s[s1[4] - '0'][i];
  for (int i = 0; i < l5; i++) r1[i + l3 - 1][col - 1] = s[s1[5] - '0'][i];
  for (int i = row; i < 32; i++) {
    for (int j = 0; j < 32; j++) {
      r1[i][j] = '.' - 1;
    }
  }
  for (int i = 0; i < 32; i++) {
    for (int j = col; j < 32; j++) {
      r1[i][j] = '.' - 1;
    }
  }
  for (int i = 0; i < 32; i++) {
    for (int j = 0; j < 32; j++) {
      if (res[i][j] > r1[i][j]) {
        ans = s1;
        for (int i1 = 0; i1 < 32; i1++)
          for (int j1 = 0; j1 < 32; j1++) res[i1][j1] = r1[i1][j1];
        return;
      } else if (res[i][j] < r1[i][j]) {
        return;
      }
    }
  }
}
void check(string s1) {
  int j[6], l[6];
  for (int i = 0; i < 6; i++) {
    j[i] = s1[i] - '0';
    l[i] = s[j[i]].length() - 1;
  }
  if (l[1] != l[0] + l[2]) return;
  if (l[4] != l[3] + l[5]) return;
  if (s[j[0]][0] == s[j[3]][0] && s[j[0]][l[0]] == s[j[4]][0] &&
      s[j[2]][0] == s[j[4]][l[4]] && s[j[2]][l[2]] == s[j[5]][l[5]] &&
      s[j[1]][0] == s[j[3]][l[3]] && s[j[1]][l[1]] == s[j[5]][0] &&
      s[j[1]][l[0]] == s[j[4]][l[3]]) {
    comp(s1);
  }
}
void rec(int mask, string s1) {
  if (mask == (1 << 6) - 1) {
    check(s1);
    return;
  }
  for (int i = 0; i < 6; i++) {
    if (!(mask & (1 << i))) {
      char v = '0' + i;
      rec(mask | (1 << i), s1 + v);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  for (int i = 0; i < 32; i++)
    for (int j = 0; j < 32; j++) res[i][j] = '.';
  for (int i = 0; i < 6; i++) cin >> s[i];
  rec(0, "");
  if (ans.length() == 0) {
    cout << "Impossible";
  } else {
    int col = s[ans[1] - '0'].length();
    int row = s[ans[4] - '0'].length();
    for (int i = 0; i < row; i++) {
      for (int j = 0; j < col; j++) {
        cout << res[i][j];
      }
      cout << "\n";
    }
  }
  return 0;
}
