#include <bits/stdc++.h>
using namespace std;
bool comp(string a, string b) {
  for (int _n(a.size()), i(0); i < _n; i++) a[i] = tolower(a[i]);
  for (int _n(b.size()), i(0); i < _n; i++) b[i] = tolower(b[i]);
  return a == b;
}
int main() {
  int N;
  cin >> N;
  string s[100], txt;
  for (int _n(N), i(0); i < _n; i++) cin >> s[i];
  cin >> txt;
  char c;
  cin >> c;
  bool u[100] = {0};
  for (int _n(N), i(0); i < _n; i++)
    for (int _n(int(txt.size()) - int(s[i].size()) + 1), j(0); j < _n; j++)
      if (comp(txt.substr(j, s[i].size()), s[i]))
        for (int _n(s[i].size()), k(0); k < _n; k++) u[j + k] = true;
  for (int _n(txt.size()), i(0); i < _n; i++)
    if (u[i]) {
      char cc = tolower(txt[i]);
      if (cc != c)
        cc = c;
      else {
        if (cc == 'a')
          cc = 'b';
        else
          cc = 'a';
      }
      txt[i] = isupper(txt[i]) ? toupper(cc) : cc;
    }
  cout << txt << endl;
  return 0;
}
