#include <bits/stdc++.h>
using namespace std;
int n;
vector<string> x;
string s, sx;
char c;
bool fa[1000];
int main() {
  cin >> n;
  x = vector<string>(n);
  for (int i = 0; i < n; ++i) {
    cin >> x[i];
    for (int j = 0; j < x[i].size(); ++j) x[i][j] = tolower(x[i][j]);
  }
  cin >> s;
  sx = s;
  cin >> c;
  for (int i = 0; i < sx.size(); ++i) {
    sx[i] = tolower(sx[i]);
    fa[i] = false;
  }
  string res = "";
  for (int i = 0; i < sx.size(); ++i) {
    for (int j = 0; j < x.size(); ++j) {
      if (i + x[j].size() > sx.size()) continue;
      if (sx.substr(i, x[j].size()) == x[j])
        for (int k = 0; k < x[j].size(); ++k) fa[i + k] = true;
    }
  }
  for (int i = 0; i < s.size(); ++i) {
    if (fa[i]) {
      char sw = c;
      if (tolower(s[i]) == c) {
        sw = (c == 'a' ? 'b' : 'a');
      }
      if (isupper(s[i]))
        s[i] = toupper(sw);
      else
        s[i] = sw;
    }
  }
  res = s;
  cout << res;
  return 0;
}
