#include <bits/stdc++.h>
using namespace std;
int n;
string w;
vector<string> s;
string tt;
char t;
vector<bool> f;
bool h;
int a;
bool eq(char p, char q) { return (p == q || p == q + 32 || p + 32 == q); }
int main() {
  cin >> n;
  s.resize(n);
  for (int i = 0; i < n; i++) cin >> s[i];
  cin >> w >> tt;
  t = tt[0];
  f.assign(w.size(), false);
  for (int i = 0; i < n; i++)
    for (int j = 0; j <= (int)w.size() - (int)s[i].size(); j++) {
      h = true;
      for (int k = 0; h && k < s[i].size(); k++)
        if (!eq(w[j + k], s[i][k])) h = false;
      if (h)
        for (int k = 0; k < s[i].size(); k++) f[j + k] = true;
    }
  for (int i = 0; i < f.size(); i++)
    if (f[i]) {
      if (w[i] <= 'Z')
        a = 0;
      else
        a = 32;
      if (w[i] + 32 - a == t) {
        if (t == 'a')
          w[i] = 'B' + a;
        else
          w[i] = 'A' + a;
      } else
        w[i] = t - 32 + a;
    }
  cout << w;
  return 0;
}
