#include <bits/stdc++.h>
using namespace std;
string s[100], t[100];
bool mark[100];
string C(string str) {
  string res = str;
  for (int i = 0; i < res.size(); i++)
    if (res[i] >= 'A' && res[i] <= 'Z') res[i] = res[i] - 'A' + 'a';
  return res;
}
int main() {
  int n;
  char tt, ss, SS;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    t[i] = C(s[i]);
  }
  string str, rts;
  cin >> str;
  cin >> tt;
  if (tt >= 'A' && tt <= 'Z') tt = tt - 'A' + 'a';
  char TT = tt - 'a' + 'A';
  ss = 'a';
  SS = 'A';
  if (tt == 'a') {
    ss = 'b';
    SS = 'B';
  }
  rts = C(str);
  for (int i = 0; i < rts.size(); i++) {
    for (int j = 0; j < n; j++)
      if (rts.substr(i, t[j].size()) == t[j]) {
        for (int k = i; k < i + t[j].size(); k++) mark[k] = 1;
      }
  }
  for (int i = 0; i < str.size(); i++)
    if (!mark[i])
      printf("%c", str[i]);
    else {
      if (str[i] == tt) {
        printf("%c", ss);
        continue;
      }
      if (str[i] == TT) {
        printf("%c", SS);
        continue;
      }
      if (str[i] >= 'a' && str[i] <= 'z') {
        printf("%c", tt);
        continue;
      }
      printf("%c", TT);
    }
  printf("\n");
}
