#include <bits/stdc++.h>
using namespace std;
string s[10];
int l[10];
int main() {
  vector<string> ans;
  ans.clear();
  for (int i = 0; i < 6; ++i) {
    cin >> s[i];
  }
  sort(s, s + 6);
  do {
    for (int i = 0; i < 6; ++i) {
      l[i] = s[i].size();
    }
    if (l[0] + l[2] == l[1] + 1 && l[3] + l[5] == l[4] + 1) {
      if (s[0][0] == s[3][0])
        if (s[0][l[0] - 1] == s[4][0])
          if (s[1][0] == s[3][l[3] - 1])
            if (s[1][l[0] - 1] == s[4][l[3] - 1])
              if (s[1][l[1] - 1] == s[5][0])
                if (s[2][0] == s[4][l[4] - 1])
                  if (s[2][l[2] - 1] == s[5][l[5] - 1]) {
                    vector<string> w(l[1], string(l[4], '.'));
                    int x = 0, y = 0;
                    for (int k = 0; k < l[0]; ++k) {
                      w[x][y] = s[0][k];
                      x += 1;
                    }
                    x = 0, y = l[3] - 1;
                    for (int k = 0; k < l[1]; ++k) {
                      w[x][y] = s[1][k];
                      x += 1;
                    }
                    x = l[0] - 1, y = l[4] - 1;
                    for (int k = 0; k < l[2]; ++k) {
                      w[x][y] = s[2][k];
                      x += 1;
                    }
                    x = 0, y = 0;
                    for (int k = 0; k < l[3]; ++k) {
                      w[x][y] = s[3][k];
                      y += 1;
                    }
                    x = l[0] - 1, y = 0;
                    for (int k = 0; k < l[4]; ++k) {
                      w[x][y] = s[4][k];
                      y += 1;
                    }
                    x = l[1] - 1, y = l[3] - 1;
                    for (int k = 0; k < l[5]; ++k) {
                      w[x][y] = s[5][k];
                      y += 1;
                    }
                    if (ans > w || ans.size() == 0) ans = w;
                  }
    }
  } while (next_permutation(s, s + 6));
  if (ans.size() == 0) {
    puts("Impossible");
    return 0;
  }
  for (int i = 0; i < ans.size(); ++i) {
    cout << ans[i] << endl;
  }
  return 0;
}
