#include <bits/stdc++.h>
using namespace std;
const int N = 40, inf = 1e9;
string second[7], res[50];
int n, a[10];
bool ans;
char c[50][50];
void answer() {
  a[1] = second[1].size() + second[6].size() - 1,
  a[2] = second[2].size() + second[5].size() - 1;
  if (a[1] != second[4].size() || a[2] != second[3].size()) return;
  if (second[1][0] != second[2][0] ||
      second[1][second[1].size() - 1] != second[3][0] ||
      second[2][second[2].size() - 1] != second[4][0] ||
      second[4][second[1].size() - 1] != second[3][second[2].size() - 1])
    return;
  if (second[3][second[3].size() - 1] != second[6][0] ||
      second[4][second[4].size() - 1] != second[5][0] ||
      second[5][second[5].size() - 1] != second[6][second[6].size() - 1])
    return;
  for (int i = 1; i <= N; i++)
    for (int j = 1; j <= N; j++) c[i][j] = '.';
  for (int i = 0; i < second[1].size(); i++) c[1][i + 1] = second[1][i];
  for (int i = 0; i < second[2].size(); i++) c[i + 1][1] = second[2][i];
  for (int i = 0; i < second[3].size(); i++)
    c[i + 1][second[1].size()] = second[3][i];
  for (int i = 0; i < second[4].size(); i++)
    c[second[2].size()][i + 1] = second[4][i];
  for (int i = 0, j = second[2].size(); i < second[5].size(); i++, j++)
    c[j][second[4].size()] = second[5][i];
  for (int i = 0, j = second[1].size(); i < second[6].size(); i++, j++)
    c[second[3].size()][j] = second[6][i];
  string t[50];
  for (int i = 1; i <= a[2]; i++) t[i] = "";
  for (int i = 1; i <= a[2]; i++)
    for (int j = 1; j <= a[1]; j++) t[i] += c[i][j];
  if (!ans) {
    ans = 1;
    for (int i = 1; i <= a[2]; i++) res[i] = t[i];
    n = a[2];
  } else {
    bool ok = 0;
    for (int i = 1; i <= max(n, a[2]); i++) {
      if (res[i] < t[i]) break;
      if (res[i] > t[i]) {
        ok = 1;
        break;
      }
    }
    if (ok) {
      for (int i = 1; i <= a[2]; i++) res[i] = t[i];
      n = a[2];
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  for (int i = 1; i <= 40; i++) res[i] = "";
  for (int i = 1; i <= 6; i++) cin >> second[i];
  sort(second + 1, second + 7);
  do {
    answer();
  } while (next_permutation(second + 1, second + 7));
  if (!ans)
    cout << "Impossible";
  else {
    for (int i = 1; i < n; i++) cout << res[i] << endl;
    cout << res[n];
  }
  return 0;
}
