#include <bits/stdc++.h>
using namespace std;
const int mlen = 303;
int p[6];
string s[6];
char res[mlen][mlen];
vector<vector<string> > x;
void draw(int sx, int sy, string ss, int dx, int dy) {
  for (int i = 0; i < ss.size(); i++) res[sy][sx] = ss[i], sx += dx, sy += dy;
}
void paint() {
  int H = s[0].size() - 1;
  int W = s[1].size() - 1;
  int h = s[2].size() - 1;
  int w = s[3].size() - 1;
  draw(0, 0, s[2], 0, 1);
  draw(w, 0, s[0], 0, 1);
  draw(W, h, s[4], 0, 1);
  draw(0, 0, s[3], 1, 0);
  draw(0, h, s[1], 1, 0);
  draw(w, H, s[5], 1, 0);
}
int main() {
  for (int i = 0; i < 6; i++) getline(cin, s[i]);
  sort(s, s + 6);
  int cnt = 0;
  do {
    cnt++;
    int H = s[0].size() - 1;
    int W = s[1].size() - 1;
    int h = s[2].size() - 1;
    int w = s[3].size() - 1;
    bool bad = 0;
    bad |= (s[0].size() != s[2].size() + s[4].size() - 1);
    bad |= (s[1].size() != s[3].size() + s[5].size() - 1);
    bad |= (s[0][0] != s[3][w]);
    bad |= (s[0][h] != s[1][w]);
    bad |= (s[0][H] != s[5][0]);
    bad |= (s[2][0] != s[3][0]);
    bad |= (s[2][h] != s[1][0]);
    bad |= (s[4][0] != s[1][W]);
    bad |= (s[4][H - h] != s[5][W - w]);
    if (bad) continue;
    memset(res, '.', sizeof(res));
    paint();
    vector<string> R;
    for (int i = 0; i <= H; i++) res[i][W + 1] = 0, R.push_back(res[i]);
    x.push_back(R);
  } while (next_permutation(s, s + 6));
  sort(x.begin(), x.end());
  if (!x.size())
    puts("Impossible");
  else {
    for (int i = 0; i < x[0].size(); i++) {
      for (int j = 0; j < x[0][0].size(); j++) cout << x[0][i][j];
      puts("");
    }
  }
  return 0;
}
