#include <bits/stdc++.h>
using namespace std;
string a, b;
char s[100], *p;
bool t;
int s1, s2, x;
int main() {
  cin >> s;
  t = 0;
  for (p = s; *p; p++) {
    if (*p == '|') {
      t = 1;
      continue;
    }
    if (!t) {
      s1++;
      a += *p;
    } else {
      s2++;
      b += *p;
    }
  }
  cin >> s;
  x = strlen(s);
  p = s;
  if ((s1 + s2 + x) % 2) {
    cout << "Impossible";
    return 0;
  }
  x = (s1 + s2 + x) / 2;
  if (x < s1 || x < s2) {
    cout << "Impossible";
    return 0;
  }
  while (x > a.size()) {
    a += *p;
    p++;
  }
  while (x > b.size()) {
    b += *p;
    p++;
  }
  cout << a << "|" << b;
  return 0;
}
