#include <bits/stdc++.h>
using namespace std;
void st(string &w) {
  int si = w.size();
  for (int i = 0; i < si; ++i) {
    for (int j = 0; j < si; ++j) {
      if (w[i] < w[j] && i != j && w[i] != '|' && w[j] != '|') {
        swap(w[j], w[i]);
      }
    }
  }
}
int main() {
  string str, ss, ls = "", rs = "", mid = "";
  cin >> str;
  cin >> ss;
  int r = 0, l = 0, s1 = str.size(), s2 = ss.size(), K = 0;
  if (((s1 + s2 - 1) % 2) != 0) {
    cout << "Impossible";
    return 0;
  }
  for (int i = 0; i < s1; ++i) {
    if (str[i] == '|') break;
    ls += str[i];
  }
  for (int i = 0; i < s1; ++i) {
    if (str[s1 - 1 - i] == '|') break;
    rs += str[s1 - 1 - i];
  }
  r = rs.size();
  l = ls.size();
  K = (r + l + s2) / 2;
  if (ls.size() > rs.size()) {
    for (int i = 0; i < s2; ++i) {
      if (l < K) {
        ++l;
        ls += ss[i];
      } else {
        r++;
        rs += ss[i];
      }
    }
    if (r != l) {
      cout << "Impossible";
      return 0;
    }
    st(ls);
    st(rs);
    cout << ls << '|' << rs;
    return 0;
  } else {
    for (int i = 0; i < s2; ++i) {
      if (r < K) {
        ++r;
        rs += ss[i];
      } else {
        l++;
        ls += ss[i];
      }
    }
    if (r != l) {
      cout << "Impossible";
      return 0;
    }
    st(ls);
    st(rs);
    cout << ls << '|' << rs;
    return 0;
  }
}
