#include <bits/stdc++.h>
using namespace std;
string s[105], t;
string sl[105], tl;
bool ok[105];
int n;
string getLower(string s) {
  for (int i = 0; i < s.size(); ++i) s[i] = tolower(s[i]);
  return s;
}
int main() {
  cin >> n;
  int i, j, k;
  for (i = 0; i < n; ++i) {
    cin >> s[i];
    sl[i] = getLower(s[i]);
  }
  cin >> t;
  tl = getLower(t);
  char letter;
  cin >> letter;
  int len = t.size();
  for (i = 0; i < n; ++i) {
    int m = s[i].size();
    for (j = 0; j <= len - m; ++j)
      if (tl.substr(j, m) == sl[i]) {
        for (k = 0; k < m; ++k) ok[j + k] = 1;
      }
  }
  for (i = 0; i < len; ++i)
    if (ok[i]) {
      bool flag = isupper(t[i]);
      if (tl[i] == letter) {
        if (letter == 'a')
          t[i] = 'b';
        else
          t[i] = 'a';
      } else
        t[i] = letter;
      if (flag) t[i] = toupper(t[i]);
    }
  cout << t << endl;
  return 0;
}
