#include <bits/stdc++.h>
using namespace std;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c* x) -> decltype(cerr << *x, 0);
template <class c>
char dud(...);
struct debug {
  template <class c>
  debug& operator<<(const c&) {
    return *this;
  }
};
int main() {
  vector<string> in(6);
  for (int i = 0; i < 6; ++i) {
    cin >> in[i];
  }
  sort(in.begin(), in.end());
  vector<string> ans;
  do {
    string a = in[0], b = in[1], c = in[2], d = in[3];
    string e = in[4], f = in[5];
    int A = a.length();
    int B = b.length();
    int C = c.length();
    int D = d.length();
    int E = e.length();
    int F = f.length();
    int H = D;
    int W = C;
    vector<string> grid(H, string(W, '.'));
    bool ok = true;
    auto foo = [&](int row, int col, string s, bool is_hori) {
      for (int i = 0; i < (int)s.length(); ++i) {
        if (row < H && col < W) {
          if (grid[row][col] != '.' && grid[row][col] != s[i]) {
            ok = false;
          } else
            grid[row][col] = s[i];
        } else {
          ok = false;
        }
        if (is_hori)
          col++;
        else
          row++;
      }
    };
    const bool HORI = true;
    const bool VERT = false;
    foo(0, 0, a, HORI);
    foo(0, 0, b, VERT);
    foo(0, A - 1, d, VERT);
    foo(B - 1, 0, c, HORI);
    foo(D - 1, A - 1, e, HORI);
    foo(B - 1, C - 1, f, VERT);
    if (A + E == C + 1 && B + F == D + 1) {
    } else {
      ok = false;
    }
    if (!ok) {
      continue;
    }
    if (ans.empty() || grid < ans) {
      ans = grid;
    }
  } while (next_permutation(in.begin(), in.end()));
  if (ans.empty()) {
    puts("Impossible");
  }
  for (string s : ans) {
    cout << s << endl;
  }
}
