#include <bits/stdc++.h>
using namespace std;
string upp(string s) {
  for (int i = 0; i < s.size(); i++)
    if (s[i] > 'Z') s[i] -= 32;
  return s;
}
int main() {
  int n;
  cin >> n;
  vector<string> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    v[i] = upp(v[i]);
  }
  string w, aux;
  cin >> w;
  aux = upp(w);
  bool F[100] = {};
  for (int i = 0; i < n; i++)
    for (int j = 0; j + v[i].size() <= w.size(); j++) {
      if (aux.substr(j, v[i].size()) == v[i])
        for (int k = j; k < j + v[i].size(); k++) F[k] = 1;
    }
  char l;
  cin >> l;
  l -= 32;
  for (int i = 0; i < w.size(); i++)
    if (F[i]) {
      if (aux[i] == l) {
        if (w[i] <= 'Z')
          w[i] = 'A' + (w[i] == 'A');
        else
          w[i] = 'a' + (w[i] == 'a');
      } else {
        if (w[i] <= 'Z')
          w[i] = l;
        else
          w[i] = (l + 32);
      }
    }
  cout << w << endl;
  return 0;
}
