#include <bits/stdc++.h>
using namespace std;
int mm(int a, int b) { return a > b ? a : b; }
void fn() {
  int n;
  int i;
  string s, a, b, c;
  int len1, len2;
  cin >> s >> c;
  for (i = 0; i < s.size(); i++)
    if (s[i] == '|') break;
  a = s.substr(0, i);
  b = s.substr(i + 1, s.size() - i - 1);
  len1 = a.size();
  len2 = b.size();
  if (len1 < len2) {
    int t;
    t = len1;
    len1 = len2;
    len2 = t;
  }
  if ((a.size() + b.size() + c.size()) % 2 != 0 || len1 > len2 + c.size())
    cout << "Impossible" << endl;
  else {
    c.insert(0, a);
    c += b;
    cout << c.substr(0, c.size() / 2) << '|';
    cout << c.substr(c.size() / 2, c.size() / 2);
  }
}
int main() {
  fn();
  return 0;
}
