#include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::endl;
using std::string;
string a[1001];
std::vector<string> best;
std::vector<string> res;
int main() {
  for (int i = 1; i <= 6; i += 1) {
    cin >> a[i];
  }
  std::sort(a + 1, a + 7);
  do {
    if (a[1].length() + a[3].length() - 1 == a[2].length() &&
        a[4].length() + a[6].length() - 1 == a[5].length()) {
      if (a[1][0] != a[4][0]) continue;
      if (a[1][a[1].length() - 1] != a[5][0]) continue;
      if (a[4][a[4].length() - 1] != a[2][0]) continue;
      if (a[2][a[1].length() - 1] != a[5][a[4].length() - 1]) continue;
      if (a[2][a[2].length() - 1] != a[6][0]) continue;
      if (a[6][a[6].length() - 1] != a[3][a[3].length() - 1]) continue;
      if (a[5][a[5].length() - 1] != a[3][0]) continue;
      res = std::vector<string>(a[5].size(), string(a[2].size(), '.'));
      for (int i = 0; i < a[1].length(); i += 1) res[0][i] = a[1][i];
      for (int i = 0; i < a[2].length(); i += 1)
        res[a[4].length() - 1][i] = a[2][i];
      for (int i = 0; i < a[3].length(); i += 1)
        res[a[5].length() - 1][i + a[1].length() - 1] = a[3][i];
      for (int i = 0; i < a[4].length(); i += 1) res[i][0] = a[4][i];
      for (int i = 0; i < a[5].length(); i += 1)
        res[i][a[1].length() - 1] = a[5][i];
      for (int i = 0; i < a[6].length(); i += 1)
        res[i + a[4].length() - 1][a[2].length() - 1] = a[6][i];
      if (best.size() == 0 || res < best) {
        best = res;
      }
    }
  } while (next_permutation(a + 1, a + 7));
  if (best.size() == 0)
    printf("Impossible\n");
  else {
    for (int i = 0; i < best.size(); i += 1) {
      std::cout << best[i] << endl;
    }
  }
  return 0;
}
