#include <bits/stdc++.h>
using namespace std;
string tolower(string str) {
  for (int i = 0; i < str.size(); i++) str[i] = tolower(str[i]);
  return str;
}
int main() {
  int n;
  cin >> n;
  vector<string> store;
  for (int i = 0; i < n; i++) {
    string str;
    cin >> str;
    store.push_back(tolower(str));
  }
  string str, temp, ans = "";
  cin >> temp;
  vector<int> color(temp.size());
  str = tolower(temp);
  char letter;
  cin >> letter;
  for (int i = 0; i < str.size(); i++) {
    for (int j = 0; j < store.size(); j++) {
      string& here = store[j];
      if (i + here.size() <= str.size()) {
        string substr = str.substr(i, here.size());
        if (substr == here) {
          for (int k = i; k < i + here.size(); k++) color[k] = 1;
        }
      }
    }
  }
  char second = (letter == 'a') ? 'b' : 'a';
  for (int i = 0; i < str.size(); i++) {
    if (color[i])
      ans += (str[i] == letter) ? second : letter;
    else
      ans += str[i];
    if (isupper(temp[i])) ans[i] = toupper(ans[i]);
  }
  cout << ans << endl;
  return 0;
}
