#include <bits/stdc++.h>
using namespace std;
bool cmp1(pair<int, int> a, pair<int, int> b) { return a.second > b.second; }
void showvd(vector<double> v) {
  cout << v.size() << endl;
  for (int i = 0; i < v.size(); i++) cout << v[i] << " " << endl;
}
void showvi(vector<int> v) {
  for (int i = 0; i < v.size(); i++) cout << v[i] << " ";
  cout << endl;
}
void showvl(vector<long long> v) {
  for (int i = 0; i < v.size(); i++) cout << v[i] << " ";
  cout << endl;
}
void showvp(vector<pair<int, int>> v) {
  for (int i = 0; i < v.size(); i++)
    cout << v[i].first << " " << v[i].second << endl;
}
long long fastpower(long long a, long long n, long long p) {
  long long ans = 1;
  while (n > 0) {
    if (n & 1) ans = (ans * a) % p;
    a = (a * a) % p;
    n = n >> 1;
  }
  return ans % p;
}
void factor(int n, vector<int> &v) {
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      v.push_back(i);
      int z = n / i;
      if (z != i) v.push_back(z);
    }
  }
}
int prime[10000001];
void SOE() {
  for (int i = 1; i <= 10000000; i++) prime[i] = i;
  for (int p = 2; p * p <= 10000000; p++) {
    if (prime[p] == p) {
      for (int i = p * p; i <= 10000000; i += p) {
        if (prime[i] == i) prime[i] = p;
      }
    }
  }
}
vector<string> v(6);
vector<vector<string>> res;
vector<vector<string>> out;
int a[6];
bool com(vector<string> &a, vector<string> &b) {
  int A = a.size(), B = b.size();
  for (int i = 0; i < min(A, B); i++) {
    if (a[i] == b[i]) continue;
    return a[i] < b[i];
  }
  return A < B;
}
void build() {
  for (int j = 0; j < res.size(); j++) {
    int len[6];
    vector<string> str(6);
    for (int i = 0; i < 6; i++) {
      str[i] = res[j][i];
      len[i] = str[i].length();
    }
    int rows = len[2];
    int col = len[3];
    vector<string> ans(rows);
    for (int i = 0; i < rows; i++) {
      ans[i] = "";
      for (int j = 0; j < col; j++) {
        ans[i] += ".";
      }
    }
    for (int i = 0; i < len[0]; i++) ans[0][i] = str[0][i];
    for (int i = 0; i < len[1]; i++) ans[i][0] = str[1][i];
    for (int i = 0; i < len[2]; i++) ans[i][len[0] - 1] = str[2][i];
    for (int i = 0; i < len[3]; i++) ans[len[1] - 1][i] = str[3][i];
    for (int i = 0; i < len[4]; i++)
      ans[len[1] - 1 + i][len[3] - 1] = str[4][i];
    for (int i = 0; i < len[5]; i++)
      ans[len[2] - 1][len[0] - 1 + i] = str[5][i];
    out.push_back(ans);
  }
}
void solve() {
  for (int i = 0; i < 6; i++) cin >> v[i];
  sort(v.begin(), v.end());
  int flag = 0;
  for (int i = 0; i < 6; i++) a[i] = i;
  do {
    int l1 = v[a[0]].length();
    int l2 = v[a[1]].length();
    int l3 = v[a[2]].length();
    int l4 = v[a[3]].length();
    int l5 = v[a[4]].length();
    int l6 = v[a[5]].length();
    if (l1 + l6 - 1 != l4) continue;
    if (l2 + l5 - 1 != l3) continue;
    if (v[a[0]][0] != v[a[1]][0]) continue;
    if (v[a[0]][l1 - 1] != v[a[2]][0]) continue;
    if (v[a[1]][l2 - 1] != v[a[3]][0]) continue;
    if (l3 <= l2 || l4 <= l1 || v[a[3]][l1 - 1] != v[a[2]][l2 - 1]) continue;
    if (v[a[3]][l4 - 1] != v[a[4]][0]) continue;
    if (v[a[2]][l3 - 1] != v[a[5]][0]) continue;
    if (v[a[5]][l6 - 1] != v[a[4]][l5 - 1]) continue;
    flag = 1;
    vector<string> temp;
    temp.push_back(v[a[0]]);
    temp.push_back(v[a[1]]);
    temp.push_back(v[a[2]]);
    temp.push_back(v[a[3]]);
    temp.push_back(v[a[4]]);
    temp.push_back(v[a[5]]);
    res.push_back(temp);
  } while (next_permutation(a, a + 6));
  if (flag) {
    build();
    sort(begin(out), end(out), com);
    for (int i = 0; i < out[0].size(); i++) {
      cout << out[0][i] << endl;
    }
  } else
    cout << "Impossible";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  for (int i = 0; i < t; i++) {
    solve();
  }
  return 0;
}
