#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  string r;
  cin >> r;
  string a, b;
  bool seen = false;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == '|') {
      seen = true;
    } else {
      if (!seen) {
        a += s[i];
      } else {
        b += s[i];
      }
    }
  }
  int c = r.length();
  int l = a.length();
  int ri = b.length();
  int la = abs(l - ri);
  if (la > c) {
    cout << "Impossible" << endl;
    return 0;
  }
  c -= la;
  if (c & 1) {
    cout << "Impossible" << endl;
    return 0;
  }
  int g = 0;
  for (int i = 0; i < la; i++) {
    if (ri < l) {
      b += r[g];
    } else {
      a += r[g];
    }
    g++;
  }
  for (int i = 0; i < c / 2; i++) {
    a += r[g];
    g++;
  }
  for (int i = 0; i < c / 2; i++) {
    b += r[g];
    g++;
  }
  cout << a << "|" << b << endl;
  return 0;
}
