#include <bits/stdc++.h>
using namespace std;
inline long long int add(long long int a, long long int b, long long int mod) {
  return ((a % mod) + (b % mod)) % mod;
}
inline long long int sub(long long int a, long long int b, long long int mod) {
  return ((a % mod) - (b % mod) + mod) % mod;
}
inline long long int mul(long long int a, long long int b, long long int mod) {
  return ((a % mod) * (b % mod)) % mod;
}
int search(vector<int> array, int start_idx, int end_idx, int search_val) {
  if (start_idx == end_idx)
    return array[start_idx] <= search_val ? start_idx : -1;
  int mid_idx = start_idx + (end_idx - start_idx) / 2;
  if (search_val < array[mid_idx])
    return search(array, start_idx, mid_idx, search_val);
  int ret = search(array, mid_idx + 1, end_idx, search_val);
  return ret == -1 ? mid_idx : ret;
}
long long int rem(long long int a, long long int b, long long int d) {
  a = a % d;
  if (b == 0) return 1 % d;
  if (b == 1) return a % d;
  if (b % 2 == 0) return rem((a * a) % d, b / 2, d);
  if (b % 2 == 1) return (a * rem((a * a) % d, b / 2, d)) % d;
}
bool cmp(vector<string> &a, vector<string> &b) {
  for (int i = 0; i < min((int)a.size(), (int)b.size()); i++) {
    if (a[i] == b[i]) continue;
    return a[i] < b[i];
  }
  return (int)a.size() < (int)b.size();
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string s[6];
  int i, lon = -1, len = 0;
  vector<pair<string, int> > top_left, bot_right, left, right;
  for (i = 0; i < 6; i++) {
    cin >> s[i];
  }
  sort(s, s + 6);
  vector<vector<string> > v;
  int temp, flag1 = 0, flag2 = 0, flag3 = 0, flag4 = 0;
  int j, k, m, n, p, y, z, q, r;
  for (q = 0; q < 6; q++) {
    lon = q;
    len = (int)s[lon].size();
    top_left.clear();
    bot_right.clear();
    for (r = 0; r < 6; r++) {
      if (r != lon) {
        if (s[r][(int)s[r].size() - 1] == s[lon][0]) {
          top_left.push_back(make_pair(s[r], r));
        }
        if (s[r][0] == s[lon][(int)s[lon].size() - 1]) {
          bot_right.push_back(make_pair(s[r], r));
        }
      }
    }
    if (((int)top_left.size() == 0) || ((int)bot_right.size() == 0))
      continue;
    else {
      sort(top_left.begin(), top_left.end());
      sort(bot_right.begin(), bot_right.end());
      for (i = 0; i < (int)top_left.size(); i++) {
        temp = (int)top_left[i].first.size();
        for (j = 0; j < 6; j++) {
          if ((j != lon) && (j != top_left[i].second)) {
            for (k = 0; k < (int)s[lon].size(); k++) {
              flag1 = 0;
              if (s[j][temp - 1] == s[lon][k]) {
                flag1 = 1;
                goto l0;
              }
            l0:;
              if (flag1 == 0)
                continue;
              else {
                for (m = 0; m < 6; m++) {
                  flag2 = 0;
                  if ((m != lon) && (m != j) && (m != top_left[i].second)) {
                    if (((int)s[m].size() == k + 1) &&
                        (s[m][0] == s[top_left[i].second][0]) &&
                        (s[m][(int)s[m].size() - 1] == s[j][0])) {
                      flag2 = 1;
                      goto l1;
                    }
                  }
                l1:;
                  if (flag2 == 0)
                    continue;
                  else {
                    for (n = 0; n < 6; n++) {
                      flag3 = 0;
                      if ((n != lon) && (n != j) && (n != top_left[i].second) &&
                          (n != m)) {
                        if (((int)s[n].size() - 1 ==
                             (int)s[lon].size() - (int)s[m].size()) &&
                            (s[n][0] == s[j][(int)s[j].size() - 1])) {
                          flag3 = 1;
                          goto l2;
                          ;
                        }
                      }
                    l2:;
                      if (flag3 == 0)
                        continue;
                      else {
                        for (p = 0; p < 6; p++) {
                          if ((p != lon) && (p != j) &&
                              (p != top_left[i].second) && (p != m) &&
                              (p != n)) {
                            if (((int)s[p].size() - 1 ==
                                 (int)s[j].size() - temp) &&
                                (s[p][0] == s[lon][(int)s[lon].size() - 1]) &&
                                (s[p][(int)s[p].size() - 1] ==
                                 s[n][(int)s[n].size() - 1])) {
                              flag4 = 1;
                              vector<string> ans;
                              for (y = 0; y < len; y++) {
                                ans.push_back(string((int)s[j].size(), 'a'));
                              }
                              for (y = 0; y < temp; y++) {
                                ans[0][y] = s[top_left[i].second][y];
                              }
                              for (y = 0; y < (int)s[j].size(); y++) {
                                ans[(int)s[m].size() - 1][y] = s[j][y];
                              }
                              for (y = temp - 1; y < (int)s[j].size(); y++) {
                                ans[len - 1][y] = s[p][y - (temp - 1)];
                              }
                              for (y = 0; y < len; y++) {
                                ans[y][temp - 1] = s[lon][y];
                              }
                              for (y = 0; y < (int)s[m].size(); y++) {
                                ans[y][0] = s[m][y];
                              }
                              for (y = (int)s[m].size() - 1; y < len; y++) {
                                ans[y][(int)s[j].size() - 1] =
                                    s[n][y - ((int)s[m].size() - 1)];
                              }
                              for (y = 0; y < len; y++) {
                                for (z = 0; z < (int)s[j].size(); z++) {
                                  if (ans[y][z] == 'a') ans[y][z] = '.';
                                }
                              }
                              v.push_back(ans);
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  if (flag4 == 0)
    cout << "Impossible\n";
  else {
    sort(v.begin(), v.end(), cmp);
    for (i = 0; i < (int)v[0].size(); i++) {
      cout << v[0][i] << "\n";
    }
  }
  return 0;
}
