#include <bits/stdc++.h>
using namespace std;
int mark[1001];
int main() {
  ios::sync_with_stdio(false);
  string str, w, temp, z;
  int i, j, k, n, lw, f;
  char ch, des;
  vector<string> v;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> str;
    for (j = 0; j < str.length(); j++) str[j] = tolower(str[j]);
    v.push_back(str);
  }
  cin >> z;
  w = z;
  for (j = 0; j < z.length(); j++) w[j] = tolower(z[j]);
  cin >> ch;
  lw = w.length();
  for (i = 0; i < lw; i++) {
    for (j = 1; j <= lw - i; j++) {
      temp = w.substr(i, j);
      f = 0;
      for (k = 0; k < v.size(); k++) {
        if (v[k] == temp) {
          f = 1;
          break;
        }
      }
      if (f) {
        for (k = i; k <= i + j - 1; k++) mark[k] = 1;
      }
    }
  }
  for (i = 0; i < lw; i++) {
    if (mark[i]) {
      if (z[i] >= 'a' && z[i] <= 'z')
        des = tolower(ch);
      else
        des = toupper(ch);
      if (z[i] != des) {
        z[i] = des;
      } else {
        if (z[i] == 'a')
          z[i] = 'b';
        else if (z[i] == 'A')
          z[i] = 'B';
        else {
          if (z[i] >= 'a' && z[i] <= 'z')
            z[i] = 'a';
          else
            z[i] = 'A';
        }
      }
    }
  }
  cout << z;
  return 0;
}
