#include <bits/stdc++.h>
using namespace std;
string tolow(string s) {
  for (int i = 0; i < s.size(); i++) s[i] = tolower(s[i]);
  return s;
}
int main() {
  int n;
  while (cin >> n) {
    vector<string> vec(n);
    string s;
    int arr[103] = {0};
    char f;
    for (int i = 0; i < n; i++) {
      cin >> vec[i];
      vec[i] = tolow(vec[i]);
    }
    cin >> s >> f;
    string s1 = s;
    s = tolow(s);
    for (int i = 0; i < s.size(); i++) {
      for (int j = 0; j < n; j++) {
        if (vec[j].size() + i <= s.size() &&
            vec[j] == s.substr(i, vec[j].size())) {
          for (int k = i; k < i + vec[j].size(); k++) {
            arr[k] = 1;
          }
        }
      }
    }
    s = s1;
    for (int i = 0; i < s.size(); i++) {
      if (arr[i]) {
        if ((isupper(s[i]) && s[i] != toupper(f)))
          s[i] = toupper(f);
        else if ((islower(s[i]) && s[i] != tolower(f)))
          s[i] = tolower(f);
        else if (s[i] == 'a' || s[i] == 'A')
          s[i]++;
        else
          isupper(s[i]) ? s[i] = 'A' : s[i] = 'a';
      }
    }
    cout << s << endl;
  }
}
