#include <bits/stdc++.h>
using namespace std;
string low(string s) {
  string tmp;
  for (int i = 0; i < s.size(); i++) {
    tmp += (char)tolower(s[i]);
  }
  return tmp;
}
int main() {
  int n;
  cin >> n;
  string s;
  vector<string> ss;
  for (int i = 0; i < n; i++) {
    cin >> s;
    ss.push_back(low(s));
  }
  string letter;
  cin >> s;
  string fir = s;
  s = "";
  for (int i = 0; i < fir.size(); i++) {
    s += (char)tolower(fir[i]);
  }
  cin >> letter;
  bool mark[100 + 10];
  memset(mark, false, sizeof(mark));
  int pos = 0;
  for (int i = 0; i < ss.size(); i++) {
    pos = 0;
    for (int j = 0; j < int(s.size() - ss[i].size() + 1); j++) {
      if (s.substr(j, ss[i].size()).compare(ss[i]) == 0)
        for (int k = j; k < j + ss[i].size(); k++) mark[k] = true;
    }
  }
  char ch = letter[0];
  for (int i = 0; i < 110; i++) {
    if (mark[i]) {
      if (s[i] == ch) {
        if (s[i] == 'a') {
          s[i] = 'b';
        } else
          s[i] = 'a';
      } else
        s[i] = ch;
    }
  }
  for (int i = 0; i < fir.size(); i++) {
    if (isupper(fir[i])) {
      cout << (char)toupper(s[i]);
    } else
      cout << s[i];
  }
  cin >> s;
  return 0;
}
