#include <bits/stdc++.h>
using namespace std;
int min(int a, int b) {
  if (a < b)
    return a;
  else
    return b;
}
int mod(int a) {
  if (a < 0)
    return -a;
  else
    return a;
}
int main(void) {
  char c;
  string lt, rt;
  int fl = 1, l = 0, r = 0, t, m, i = 1;
  while (scanf("%c", &c) != 0) {
    if (c == '\n') break;
    if (c == '|')
      fl = 0;
    else {
      if (fl)
        lt.push_back(c);
      else
        rt.push_back(c);
    }
  }
  l = lt.length();
  r = rt.length();
  t = mod(l - r);
  m = min(l, r);
  while (scanf("%c", &c) != 0) {
    if (c == '\n') break;
    if (t > 0) {
      if (m == l)
        lt.push_back(c);
      else
        rt.push_back(c);
      t--;
    } else {
      if (i % 2)
        lt.push_back(c);
      else
        rt.push_back(c);
      i++;
    }
  }
  l = lt.length();
  r = rt.length();
  if (l == r)
    printf("%s|%s\n", lt.c_str(), rt.c_str());
  else
    printf("Impossible\n");
  return 0;
}
