#include <bits/stdc++.h>
using namespace std;
int in() {
  int x = 0, c;
  for (; (unsigned)((c = getchar()) - '0') >= 10;) {
    if (c == '-') return -in();
    if (!~c) throw ~0;
  }
  do {
    x = (x << 3) + (x << 1) + (c - '0');
  } while ((unsigned)((c = getchar()) - '0') < 10);
  return x;
}
long long In() {
  long long x = 0, c;
  for (; (unsigned)((c = getchar()) - '0') >= 10;) {
    if (c == '-') return -In();
    if (!~c) throw ~0;
  }
  do {
    x = (x << 3) + (x << 1) + (c - '0');
  } while ((unsigned)((c = getchar()) - '0') < 10);
  return x;
}
void printv(vector<string> &ans, int x, int y, const string &s) {
  for (int i = 0; i < ((int)(s.size())); ++i) ans[x + i][y] = s[i];
}
void printh(vector<string> &ans, int x, int y, const string &s) {
  for (int i = 0; i < ((int)(s.size())); ++i) ans[x][y + i] = s[i];
}
vector<string> solve(const vector<string> &s) {
  vector<string> ans;
  if (((int)(s[1].size())) + ((int)(s[5].size())) - 1 != ((int)(s[2].size())))
    return ans;
  if (((int)(s[0].size())) + ((int)(s[4].size())) - 1 != ((int)(s[3].size())))
    return ans;
  if (((int)(s[1].size())) < 3 || ((int)(s[5].size())) < 3 ||
      ((int)(s[0].size())) < 3 || ((int)(s[4].size())) < 3)
    return ans;
  if (s[0][0] != s[1][0]) return ans;
  if (s[0][((int)(s[0].size())) - 1] != s[2][0]) return ans;
  if (s[1][((int)(s[1].size())) - 1] != s[3][0]) return ans;
  if (s[2][((int)(s[1].size())) - 1] != s[3][((int)(s[0].size())) - 1])
    return ans;
  if (s[3][((int)(s[3].size())) - 1] != s[5][0]) return ans;
  if (s[2][((int)(s[2].size())) - 1] != s[4][0]) return ans;
  if (s[4][((int)(s[4].size())) - 1] != s[5][((int)(s[5].size())) - 1])
    return ans;
  ans = vector<string>(((int)(s[3].size())), string(((int)(s[2].size())), '.'));
  printh(ans, 0, 0, s[1]);
  printh(ans, ((int)(s[0].size())) - 1, 0, s[2]);
  printh(ans, ((int)(s[3].size())) - 1, ((int)(s[1].size())) - 1, s[5]);
  printv(ans, 0, 0, s[0]);
  printv(ans, 0, ((int)(s[1].size())) - 1, s[3]);
  printv(ans, ((int)(s[0].size())) - 1, ((int)(s[2].size())) - 1, s[4]);
  return ans;
}
int main() {
  vector<string> s(6);
  for (int i = 0; i < 6; ++i) cin >> s[i];
  sort(s.begin(), s.end());
  vector<string> ans;
  do {
    vector<string> res = solve(s);
    if (!res.empty() && (ans.empty() || res < ans)) ans = res;
  } while (next_permutation(s.begin(), s.end()));
  if (!ans.empty()) {
    for (int i = 0; i < ((int)(ans.size())); ++i) cout << ans[i] << endl;
  } else {
    puts("Impossible");
  }
  return 0;
}
