#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, k, n, m = 0, t = 0;
  char a[100], b[100], c[100];
  scanf("%s", a);
  for (j = 0; a[j] != '|'; j++)
    ;
  for (k = 0; a[j + k + 1]; k++) b[k] = a[j + k + 1];
  a[j] = b[k] = '\0';
  scanf("%s", c);
  for (n = 0; c[n]; n++)
    ;
  if ((j + k + n) % 2 == 0) {
    if (j <= k) {
      if (k <= (j + k + n) / 2) {
        for (i = j; i < (j + k + n) / 2; i++) a[i] = c[t++];
        a[i] = '\0';
        for (i = k; i < (j + k + n) / 2; i++) b[i] = c[t++];
        b[i] = '\0';
      } else
        m = 1;
    } else {
      if (j <= (j + k + n) / 2) {
        for (i = j; i < (j + k + n) / 2; i++) a[i] = c[t++];
        a[i] = '\0';
        for (i = k; i < (j + k + n) / 2; i++) b[i] = c[t++];
        b[i] = '\0';
      } else
        m = 1;
    }
  } else
    m = 1;
  if (m)
    printf("Impossible\n");
  else
    printf("%s|%s\n", a, b);
  return 0;
}
