#include <bits/stdc++.h>
using namespace std;
set<int> forbid;
void KMPSearch(string pat, string w, vector<int> lps) {
  int m = pat.length();
  int n = w.length();
  int i = 0;
  int j = 0;
  while (i < n) {
    if (pat[j] == w[i]) {
      i++;
      j++;
    }
    if (j == m) {
      for (int k = i - j; k < i - j + m; k++) {
        forbid.insert(k);
      }
      j = lps[j - 1];
    } else if (i < n && pat[j] != w[i]) {
      if (j != 0)
        j = lps[j - 1];
      else
        i++;
    }
  }
}
vector<int> complps(string s) {
  int n = s.length(), len = 0;
  vector<int> lps(n);
  lps[0] = 0;
  int i = 1;
  while (i < n) {
    if (s[i] == s[len]) {
      len++;
      lps[i] = len;
      i++;
    } else {
      if (len != 0)
        len = lps[len - 1];
      else {
        lps[i] = 0;
        i++;
      }
    }
  }
  return lps;
}
int main() {
  int n;
  char low, up;
  cin >> n;
  string s[n], w, wl, sl[n];
  for (int i = 0; i < n; i++) cin >> s[i];
  vector<int> lps[n];
  for (int i = 0; i < n; i++) {
    sl[i] = s[i];
    for (int j = 0; j < s[i].length(); j++) sl[i][j] = tolower(s[i][j]);
    lps[i] = complps(sl[i]);
  }
  cin >> w;
  wl = w;
  for (int i = 0; i < w.length(); i++) wl[i] = tolower(w[i]);
  for (int i = 0; i < n; i++) {
    KMPSearch(sl[i], wl, lps[i]);
  }
  cin >> low;
  low = tolower(low);
  up = toupper(low);
  for (int i = 0; i < w.length(); i++) {
    if (forbid.find(i) != forbid.end()) {
      if (w[i] >= 'A' && w[i] <= 'Z') {
        if (w[i] == up) {
          if (up > 'A')
            w[i] = 'A';
          else
            w[i] = 'B';
        } else {
          w[i] = up;
        }
      } else {
        if (w[i] == low) {
          if (low > 'a')
            w[i] = 'a';
          else
            w[i] = 'b';
        } else {
          w[i] = low;
        }
      }
    }
  }
  cout << w << endl;
}
