#include <bits/stdc++.h>
using namespace std;
map<string, int> mp;
int ch[200];
int main() {
  int i, n, j, k;
  char let;
  string s[200], w, c;
  char nw[200];
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    cin >> s[i];
    for (j = 0; j < s[i].size(); j++) {
      if (s[i][j] > 'Z') s[i][j] = s[i][j] - 'a' + 'A';
    }
    mp[s[i]] = 1;
  }
  cin >> w;
  cin >> let;
  for (i = 0; i < w.size(); i++) {
    for (j = i; j < w.size(); j++) {
      c = "";
      for (k = i; k <= j; k++) {
        if (w[k] > 'Z')
          c += w[k] - 'a' + 'A';
        else
          c += w[k];
      }
      if (mp.count(c) > 0) {
        for (k = i; k <= j; k++) ch[k] = 1;
      }
    }
  }
  char cc;
  int up;
  if (let > 'Z') let = let - 'a' + 'A';
  for (i = 0; i < w.size(); i++) {
    if (ch[i] == 1) {
      if (w[i] > 'Z')
        cc = w[i] - 'a' + 'A';
      else
        cc = w[i];
      if (w[i] > 'Z')
        up = 0;
      else
        up = 1;
      if (cc != let) {
        if (up)
          w[i] = let;
        else
          w[i] = let - 'A' + 'a';
      } else if (let != 'A') {
        if (up)
          w[i] = 'A';
        else
          w[i] = 'a';
      } else {
        if (up)
          w[i] = 'B';
        else
          w[i] = 'b';
      }
    }
  }
  cout << w << endl;
  return 0;
}
