#include <bits/stdc++.h>
using namespace std;
template <typename A>
string to_string(A* ptr) {
  stringstream ss;
  ss << "0x" << std::setw(16) << std::setfill('0') << std::hex
     << (uint64_t)(uintptr_t)ptr;
  return ss.str();
}
string to_string(char c) { return ((string) "'" + c) + "'"; }
template <typename A, typename B>
string to_string(pair<A, B> p);
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
string to_string(const string& s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " +
         to_string(get<2>(p)) + ")";
}
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " +
         to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
const int DIM = 6;
pair<bool, vector<string>> solve2(const vector<string>& S) {
  pair<bool, vector<string>> NO_ANS = {false, {}};
  const string& A = S[0];
  const string& B = S[1];
  const string& C = S[2];
  const string& D = S[3];
  const string& E = S[4];
  const string& F = S[5];
  if (A.size() + C.size() != B.size() + 1) return NO_ANS;
  if (D.size() + F.size() != E.size() + 1) return NO_ANS;
  if (A[0] != D[0]) return NO_ANS;
  if (A.back() != E[0]) return NO_ANS;
  if (B[0] != D.back()) return NO_ANS;
  if (B[A.size() - 1] != E[D.size() - 1]) return NO_ANS;
  if (B.back() != F[0]) return NO_ANS;
  if (C[0] != E.back()) return NO_ANS;
  if (C.back() != F.back()) return NO_ANS;
  string line;
  for (int i = 0; i < (int)B.size(); i++) line += '.';
  vector<string> R(E.size(), line);
  for (int i = 0; i < (int)A.size(); i++) R[0][i] = A[i];
  for (int i = 0; i < (int)B.size(); i++) R[(int)D.size() - 1][i] = B[i];
  for (int i = 0; i < (int)C.size(); i++)
    R[(int)E.size() - 1][i + (int)A.size() - 1] = C[i];
  for (int j = 0; j < (int)D.size(); j++) R[j][0] = D[j];
  for (int j = 0; j < (int)E.size(); j++) R[j][(int)A.size() - 1] = E[j];
  for (int j = 0; j < (int)F.size(); j++)
    R[j + (int)D.size() - 1][(int)B.size() - 1] = F[j];
  return {true, R};
}
string solve(vector<string>& S) {
  sort(S.begin(), S.end());
  pair<bool, vector<string>> result = {true, {}};
  do {
    auto [ok, res] = solve2(S);
    result = min(result, {!ok, res});
  } while (next_permutation(S.begin(), S.end()));
  if (result.first)
    return "Impossible";
  else {
    string ans = "";
    for (string s : result.second) ans += s + '\n';
    return ans;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int TT;
  TT = 1;
  for (int ttt = 0; ttt < TT; ttt++) {
    vector<string> S(DIM);
    for (string& s : S) cin >> s;
    cout << solve(S);
  }
  return 0;
}
