#include <bits/stdc++.h>
using namespace std;
bool match(char *s, int lens, char *t, int lent, int poss) {
  if (poss + lent - 1 >= lens) {
    return false;
  }
  for (int i = 0; i < lent; ++i) {
    if (toupper(s[poss + i]) != toupper(t[i])) {
      return false;
    }
  }
  return true;
}
int main() {
  int n;
  scanf("%d", &n);
  char s[n][101];
  int lens[n];
  for (int i = 0; i < n; ++i) {
    scanf(" %s", s[i]);
    lens[i] = strlen(s[i]);
  }
  char w[101];
  scanf(" %s", w);
  int lenw = strlen(w);
  char letter;
  scanf(" %c", &letter);
  bool replace[lenw];
  fill(replace, replace + lenw, false);
  for (int posw = 0; posw < lenw; ++posw) {
    for (int i = 0; i < n; ++i) {
      if (match(w, lenw, s[i], lens[i], posw)) {
        for (int j = 0; j < lens[i]; ++j) {
          replace[posw + j] = true;
        }
      }
    }
  }
  for (int posw = 0; posw < lenw; ++posw) {
    if (replace[posw]) {
      char c;
      if (toupper(w[posw]) == toupper(letter)) {
        if (toupper(letter) == 'A') {
          c = 'b';
        } else {
          c = 'a';
        }
      } else {
        c = letter;
      }
      if (isupper(w[posw])) {
        w[posw] = toupper(c);
      } else {
        w[posw] = tolower(c);
      }
    }
  }
  printf("%s\n", w);
  return 0;
}
