#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (cin >> n) {
    vector<string> v(n);
    string s;
    for (int i = 0; i < n; ++i) {
      cin >> v[i];
      for (int j = 0; j < v[i].size(); ++j) {
        if (v[i][j] >= 'A' && v[i][j] <= 'Z') v[i][j] = v[i][j] - 'A' + 'a';
      }
    }
    cin >> s;
    string ans = s;
    for (int j = 0; j < s.size(); ++j) {
      if (s[j] >= 'A' && s[j] <= 'Z') s[j] = s[j] - 'A' + 'a';
    }
    char lovable;
    cin >> lovable;
    if (lovable >= 'A' && lovable <= 'Z') lovable = lovable - 'A' + 'a';
    vector<pair<int, int> > segments;
    for (int i = 0; i < n; ++i)
      for (int j = 0; j + v[i].size() <= s.size(); ++j)
        if (s.substr(j, v[i].size()) == v[i])
          segments.push_back(make_pair(j, j + v[i].size() - 1));
    sort(segments.begin(), segments.end());
    vector<pair<int, int> > final_segments;
    for (int i = 0; i < segments.size();) {
      pair<int, int> curr = segments[i];
      int j = i;
      while (j < segments.size() && segments[j].first <= curr.second) {
        curr.second = max(curr.second, segments[j].second);
        ++j;
      }
      final_segments.push_back(curr);
      i = j;
    }
    for (int i = 0; i < final_segments.size(); ++i) {
      for (int j = final_segments[i].first; j <= final_segments[i].second;
           ++j) {
        char c = ans[j];
        if (c >= 'A' && c <= 'Z') c = c - 'A' + 'a';
        if (c == lovable) {
          char c_inv;
          for (int i = 0; i < 26; ++i) {
            if ('a' + i != lovable) {
              c_inv = 'a' + i;
              break;
            }
          }
          if (ans[j] >= 'A' && ans[j] <= 'Z')
            ans[j] = c_inv - 'a' + 'A';
          else
            ans[j] = c_inv;
        } else {
          if (ans[j] >= 'A' && ans[j] <= 'Z')
            ans[j] = lovable - 'a' + 'A';
          else
            ans[j] = lovable;
        }
      }
    }
    cout << ans << endl;
  }
}
