#include <bits/stdc++.h>
using namespace std;
int main() {
  char s1[50], s2[50];
  cin >> s1 >> s2;
  long long left = 0, right = 0, mid = 0, l;
  l = strlen(s1);
  for (long long i = 0; i < l; i++)
    if (s1[i] == '|') {
      mid = i;
      break;
    }
  left = mid;
  right = l - (mid + 1);
  if ((strlen(s1) + strlen(s2) - 1) % 2 == 1) {
    printf("Impossible");
    return 0;
  }
  if (left == right) {
    if (strlen(s2) % 2 == 0) {
      for (int j = 0; j < left; j++) printf("%c", s1[j]);
      for (int j = 0; j < strlen(s2) / 2; j++) printf("%c", s2[j]);
      printf("|");
      for (int j = left + 1; j < l; j++) printf("%c", s1[j]);
      for (int j = strlen(s2) / 2; j < strlen(s2); j++) printf("%c", s2[j]);
      return 0;
    } else {
      printf("Impossible");
      return 0;
    }
  }
  if (left < right) {
    if (right - left > strlen(s2)) {
      printf("Impossible");
      return 0;
    } else {
      long long dif = right - left;
      dif += (strlen(s2) - dif) / 2;
      for (int j = 0; j < left; j++) printf("%c", s1[j]);
      for (int j = 0; j < dif; j++) printf("%c", s2[j]);
      printf("|");
      for (int j = left + 1; j < strlen(s1); j++) printf("%c", s1[j]);
      for (int j = dif; j < strlen(s2); j++) printf("%c", s2[j]);
      return 0;
    }
  }
  if (right < left) {
    if (left - right > strlen(s2)) {
      printf("Impossible");
      return 0;
    } else {
      long long dif = left - right;
      dif = (strlen(s2) - dif) / 2;
      for (int j = 0; j < left; j++) printf("%c", s1[j]);
      for (int j = 0; j < dif; j++) printf("%c", s2[j]);
      printf("|");
      for (int j = left + 1; j < strlen(s1); j++) printf("%c", s1[j]);
      for (int j = dif; j < strlen(s2); j++) printf("%c", s2[j]);
      return 0;
    }
  }
  return 0;
}
