#include <bits/stdc++.h>
using namespace std;
map<string, bool> col;
string str;
bool canused[2000];
vector<int> capt;
string makesm(string tem) {
  int i, lim = (int)tem.size();
  for (i = 0; i <= lim - 1; i++)
    if (tem[i] < 'a') tem[i] += 32;
  return tem;
}
int main() {
  int n;
  string tem;
  while (cin >> n) {
    int i, j, k;
    for (i = 1; i <= n; i++) {
      cin >> tem;
      tem = makesm(tem);
      col[tem] = true;
    }
    char ins;
    cin >> str >> ins;
    int lim = (int)str.size();
    for (i = 0; i <= lim - 1; i++)
      if (str[i] < 'a') {
        str[i] += 32;
        capt.push_back(i);
      }
    for (i = 0; i <= lim - 1; i++)
      for (j = 1; j <= lim - i; j++)
        if (col[str.substr(i, j)]) {
          for (k = i; k <= i + j - 1; k++) canused[k] = true;
        }
    char sec = 'a';
    if (ins == 'a') sec = 'b';
    for (i = 0; i <= lim - 1; i++)
      if (canused[i]) {
        if (str[i] == ins)
          str[i] = sec;
        else
          str[i] = ins;
      }
    for (i = 0; i <= (int)capt.size() - 1; i++) str[capt[i]] -= 32;
    cout << str << endl;
  }
  return 0;
}
