#include <bits/stdc++.h>
using namespace std;
void compute() {
  string s1, s2;
  cin >> s1 >> s2;
  string l = "", r = "";
  int pos = 0;
  for (int i = 0; i < s1.length(); i++)
    if (s1[i] == '|') {
      pos = i;
      break;
    }
  r = s1.substr(pos + 1, s1.length() - pos);
  l = s1.substr(0, pos);
  if (l.length() > r.length()) {
    int rem = l.length() - r.length();
    if (s2.length() >= rem) {
      if ((s2.length() - rem) & 1)
        cout << "Impossible\n";
      else {
        r += s2.substr(0, rem);
        int k = s2.length() - rem;
        if (k > 0) {
          l += s2.substr(rem, k / 2);
          r += s2.substr(rem + k / 2, k / 2);
        }
        cout << l << "|" << r << "\n";
      }
    } else
      cout << "Impossible\n";
  } else if (l.length() < r.length()) {
    int rem = r.length() - l.length();
    if (s2.length() >= rem) {
      if ((s2.length() - rem) & 1)
        cout << "Impossible\n";
      else {
        l += s2.substr(0, rem);
        int k = s2.length() - rem;
        if (k > 0) {
          l += s2.substr(rem, k / 2);
          r += s2.substr(rem + k / 2, k / 2);
        }
        cout << l << "|" << r << "\n";
      }
    } else
      cout << "Impossible\n";
  } else if (l.length() == r.length()) {
    if (!(s2.length() & 1)) {
      l += s2.substr(0, s2.length() / 2);
      r += s2.substr(s2.length() / 2, s2.length() / 2);
      cout << l << "|" << r << "\n";
    } else
      cout << "Impossible\n";
  } else
    cout << "Impossible\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  compute();
  return 0;
}
