#include <bits/stdc++.h>
int main() {
  std::ios::sync_with_stdio(0);
  std::cin.tie(0);
  std::string weights;
  std::cin >> weights;
  std::string L;
  std::string R;
  bool sw = false;
  for (const auto &w : weights) {
    if (!sw) {
      if (w == '|') {
        sw = true;
        continue;
      } else {
        L += w;
      }
    } else {
      R += w;
    }
  }
  std::string wp;
  std::cin >> wp;
  int dfsz = L.size() > R.size() ? L.size() - R.size() : R.size() - L.size();
  if (dfsz > wp.size()) {
    std::cout << "Impossible";
  } else {
    int indexwp = 0;
    while (L.size() > R.size()) {
      R += wp.at(indexwp++);
    }
    while (R.size() > L.size()) {
      L += wp.at(indexwp++);
    }
    int w_left = wp.size() - 1 - (indexwp - 1);
    if ((w_left % 2) == 0) {
      std::string ls = wp.substr(indexwp, (w_left / 2));
      std::string rs = wp.substr(indexwp + (w_left / 2));
      L += ls;
      R += rs;
      std::cout << L << "|" << R;
    } else {
      std::cout << "Impossible";
    }
  }
  return 0;
}
