#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
const int mod = 1e9 + 7;
const long long INF = 1e18;
const long long MAX = 1e5 + 10, N = 1e6 + 10;
const int lim = 1 << 18;
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  while (cin >> n) {
    vector<string> v(n);
    for (int i = 0; i < n; i++) {
      cin >> v[i];
      for (int j = 0; j < v[i].size(); j++) v[i][j] = tolower(v[i][j]);
    }
    string s;
    char t;
    cin >> s >> t;
    t = tolower(t);
    string tmp = s;
    for (int i = 0; i < s.length(); i++) s[i] = tolower(s[i]);
    set<int> rep;
    for (int i = 0; i < s.length(); i++) {
      int sz = 0;
      for (int j = 0; j < n; j++) {
        if (i + v[j].size() - 1 < s.length() &&
            s.substr(i, v[j].size()) == v[j] && v[j].size() > sz)
          sz = v[j].size();
      }
      for (int j = i; sz; j++, sz--) rep.insert(j);
    }
    for (int i = 0; i < s.length(); i++) {
      if (!rep.count(i)) continue;
      char r = t;
      if (s[i] == t) {
        if (t == 'a')
          r = 'b';
        else
          r = 'a';
      }
      if (tmp[i] >= 'A' && tmp[i] <= 'Z')
        tmp[i] = toupper(r);
      else
        tmp[i] = tolower(r);
    }
    cout << tmp << "\n";
  }
  return 0;
}
