#include <bits/stdc++.h>
using namespace std;
int main() {
  string str, in;
  while (cin >> str >> in) {
    int index = str.find('|');
    string x, y;
    x = str.substr(0, index);
    y = str.substr(index + 1, str.size() - 1);
    while (x.size() < y.size() && in.size()) {
      char a;
      a = in[in.size() - 1];
      in.pop_back();
      x += a;
    }
    while (x.size() > y.size() && in.size()) {
      char a;
      a = in[in.size() - 1];
      in.pop_back();
      y += a;
    }
    if (x.size() == y.size()) {
      if (in.size() % 2 == 0) {
        string q, w;
        q = in.substr(0, (in.size() / 2));
        w = in.substr((in.size() / 2), in.size() - 1);
        x += q, y += w;
        cout << x << "|" << y << endl;
      } else
        cout << "Impossible" << endl;
    } else
      cout << "Impossible" << endl;
  }
}
