#include <bits/stdc++.h>
using namespace std;
char seq[30];
char weights[30], panA[30], panB[30];
int main() {
  cin >> seq;
  int lens = strlen(seq);
  int i = 0, j, mark;
  while (seq[i] != '|') {
    panA[i] = seq[i];
    i++;
  }
  mark = i;
  i = strlen(panA);
  j = mark + 1;
  while (j < lens) {
    panB[j - mark - 1] = seq[j];
    j++;
  }
  j = strlen(panB);
  cin >> weights;
  int lenw = strlen(weights);
  int diff = (i - j > 0) ? i - j : j - i;
  int ctr = 0;
  if ((lenw < diff) || ((lenw - diff) % 2)) {
    cout << "Impossible\n";
    return 0;
  } else {
    while (i < j) {
      panA[i++] = weights[ctr++];
    }
    while (j < i) {
      panB[j++] = weights[ctr++];
    }
    mark = ctr;
    while (ctr < (lenw + mark) / 2) {
      panA[i++] = weights[ctr++];
    }
    while (ctr < lenw) {
      panB[j++] = weights[ctr++];
    }
  }
  cout << panA << "|" << panB << endl;
  return 0;
}
