#include <bits/stdc++.h>
using namespace std;
int main() {
  string balance;
  cin >> balance;
  string unused;
  cin >> unused;
  int delimiterPosition =
      find(balance.begin(), balance.end(), '|') - balance.begin();
  string left = balance.substr(0, delimiterPosition);
  string right = balance.substr(delimiterPosition + 1);
  int ll = left.length();
  int lr = right.length();
  int lu = unused.length();
  if ((ll + lr + lu) % 2 == 1) {
    cout << "Impossible" << endl;
    return 0;
  }
  if (abs(ll - lr) > lu) {
    cout << "Impossible" << endl;
    return 0;
  }
  int nl, nr;
  int diff = abs(ll - lr);
  if (ll < lr) {
    nl = diff + (lu - diff) / 2;
    nr = (lu - diff) / 2;
  } else {
    nl = (lu - diff) / 2;
    nr = diff + (lu - diff) / 2;
  }
  left += unused.substr(0, nl);
  right += unused.substr(nl, nr);
  cout << left << "|" << right << endl;
  return 0;
}
