#include <bits/stdc++.h>
int valid[105];
char s[105];
char fob[105][105];
char w[105];
char tmp[105];
int main() {
  char letter;
  int n, i, lenw, len, flag, j, k;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%s", fob[i]);
  }
  scanf("%s", w);
  lenw = strlen(w);
  for (i = 0; i < n; i++) {
    len = strlen(fob[i]);
    for (j = 0; j < lenw; j++) {
      flag = 1;
      for (k = 0; k < len; k++) {
        if (tolower(w[j + k]) != tolower(fob[i][k])) {
          flag = 0;
          break;
        }
      }
      if (flag == 1) {
        for (k = 0; k < len; k++) {
          valid[j + k] = 1;
        }
      }
    }
  }
  scanf("%s", tmp);
  letter = tmp[0];
  if (letter >= 'A' && letter <= 'Z') {
    letter = letter - 'A' + 97;
  }
  for (i = 0; i < lenw; i++) {
    if (valid[i] == 1) {
      if (tolower(w[i]) != tolower(letter)) {
        if (w[i] >= 'A' && w[i] <= 'Z') {
          w[i] = letter - 97 + 65;
        } else {
          w[i] = letter;
        }
      } else {
        if (w[i] == 'a' || w[i] == 'A') {
          if (w[i] >= 'A' && w[i] <= 'Z') {
            w[i] = 'B';
          } else {
            w[i] = 'b';
          }
        } else {
          if (w[i] >= 'A' && w[i] <= 'Z') {
            w[i] = 'A';
          } else {
            w[i] = 'a';
          }
        }
      }
    }
  }
  printf("%s\n", w);
  return 0;
}
