#include <bits/stdc++.h>
using namespace std;
bool change[200];
string u(string x) {
  for (int i = 0; i < x.size(); ++i) x[i] = toupper(x[i]);
  return x;
}
int main() {
  int n;
  cin >> n;
  string bad[n];
  for (int i = 0; i < n; ++i) cin >> bad[i];
  string w;
  cin >> w;
  for (int i = 0; i < w.size(); ++i)
    for (int j = 0; j < n; ++j)
      if (u(w.substr(i, bad[j].length())) == u(bad[j]))
        for (int k = i; k < i + bad[j].length(); ++k) change[k] = true;
  char letter;
  cin >> letter;
  for (int i = 0; i < w.size(); ++i)
    if (change[i]) {
      if (toupper(w[i]) != toupper(letter))
        if (isupper(w[i]))
          w[i] = toupper(letter);
        else
          w[i] = tolower(letter);
      else {
        char start;
        if (w[i] == toupper(letter))
          start = 'A';
        else
          start = 'a';
        for (;; start++) {
          if (toupper(start) != toupper(letter)) {
            w[i] = start;
            break;
          }
        }
      }
    }
  cout << w << endl;
  return 0;
}
