#include <bits/stdc++.h>
using namespace std;
vector<string> word;
int id, batas;
bool ok, now;
string ans[55], cur[55];
bool solve() {
  if (word[0].size() + word[2].size() - 1 == word[1].size() &&
      word[3].size() + word[5].size() - 1 == word[4].size() &&
      word[3].front() == word[0].front() && word[4].front() == word[0].back() &&
      word[3].back() == word[1].front() &&
      word[4][word[3].size() - 1] == word[1][word[0].size() - 1] &&
      word[5].front() == word[1].back() && word[2].front() == word[4].back() &&
      word[2].back() == word[5].back()) {
    for (int i = 0; i < word[4].size(); i++) {
      cur[i] = "";
      for (int j = 0; j < word[1].size(); j++) {
        cur[i] += ".";
      }
    }
    for (int i = 0; i < word[0].size(); i++) {
      cur[0][i] = word[0][i];
    }
    for (int i = 0; i < word[1].size(); i++) {
      cur[word[3].size() - 1][i] = word[1][i];
    }
    for (int i = 0; i < word[2].size(); i++) {
      cur[word[4].size() - 1][i + word[0].size() - 1] = word[2][i];
    }
    for (int i = 0; i < word[3].size(); i++) {
      cur[i][0] = word[3][i];
    }
    for (int i = 0; i < word[4].size(); i++) {
      cur[i][word[0].size() - 1] = word[4][i];
    }
    for (int i = 0; i < word[5].size(); i++) {
      cur[i + word[3].size() - 1][word[1].size() - 1] = word[5][i];
    }
    return 1;
  } else {
    return 0;
  }
}
bool check() {
  int sampe = max(id, batas);
  for (int i = 0; i < sampe; i++) {
    if (i >= id) return 0;
    if (i >= batas) return 1;
    if (ans[i] != cur[i]) return cur[i] < ans[i];
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  word.resize(6);
  for (int i = 0; i < 6; i++) {
    cin >> word[i];
  }
  sort(word.begin(), word.end());
  do {
    now = solve();
    batas = word[4].size();
    if ((now && !ok) || (now && ok && check())) {
      ok = 1;
      id = batas;
      for (int i = 0; i < batas; i++) {
        ans[i] = cur[i];
      }
    }
  } while (next_permutation(word.begin(), word.end()));
  if (ok) {
    for (int i = 0; i < id; i++) {
      cout << ans[i] << '\n';
    }
  } else {
    cout << "Impossible\n";
  }
  return 0;
}
