#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100 * 1000 + 7;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  set<string> ban;
  for (int i = 0; i < n; ++i) {
    string cad;
    cin >> cad;
    transform(cad.begin(), cad.end(), cad.begin(), ::tolower);
    ban.insert(cad);
  }
  string text;
  cin >> text;
  char want;
  cin >> want;
  vector<bool> up(text.size());
  for (int i = 0; i < text.size(); ++i) up[i] = isupper(text[i]);
  transform(text.begin(), text.end(), text.begin(), ::tolower);
  vector<pair<int, int> > proc;
  vector<int> acc(text.size());
  for (auto var : ban) {
    int idx = -1;
    while ((idx = text.find(var, idx + 1)) != -1) {
      proc.push_back(pair<int, int>(idx, var.size()));
      for (int i = 0; i < var.size(); ++i) acc[idx + i]++;
    }
  }
  sort(proc.begin(), proc.end());
  vector<bool> used(text.size());
  char ini = (want == 'a' ? 'b' : 'a');
  for (int i = 0; i < proc.size(); ++i) {
    string fix = text.substr(proc[i].first, proc[i].second);
    for (int it = 0; it < fix.size(); ++it) {
      if (used[proc[i].first + it]) continue;
      fix[it] = (fix[it] == want ? ini : want);
      used[proc[i].first + it] = true;
    }
    for (int it = 0; it < fix.size(); ++it) text[proc[i].first + it] = fix[it];
  }
  for (int i = 0; i < text.size(); ++i)
    if (up[i]) text[i] = toupper(text[i]);
  cout << text << '\n';
  return 0;
}
