#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000 + 10;
int n, m;
string s[maxn];
string ssr, ch;
bool vis[maxn];
int main() {
  ios::sync_with_stdio(0);
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> s[i];
    for (auto &j : s[i]) {
      if (j < 'a') j = j - 'A' + 'a';
    }
  }
  cin >> ssr;
  string ss = ssr;
  for (auto &i : ssr) {
    if (i < 'a') i = i - 'A' + 'a';
  }
  for (int i = 0; i < ssr.size(); ++i) {
    for (int j = 0; j < n; ++j) {
      if (s[j].size() + i > ssr.size()) continue;
      int k;
      for (k = 0; k < s[j].size(); ++k) {
        if (s[j][k] != ssr[i + k]) break;
      }
      if (k == s[j].size()) {
        for (k = 0; k < s[j].size(); ++k) {
          vis[i + k] = 1;
        }
      }
    }
  }
  cin >> ch;
  if (ch[0] < 'A') ch[0] = ch[0] - 'A' + 'a';
  for (int i = 0; i < ssr.size(); ++i) {
    if (vis[i] && ssr[i] != ch[0]) {
      if (ss[i] < 'a')
        ss[i] = ch[0] - 'a' + 'A';
      else
        ss[i] = ch[0];
    } else if (vis[i]) {
      if (ch[0] == 'a') {
        if (ss[i] < 'a')
          ss[i] = 'B';
        else
          ss[i] = 'b';
      } else if (ss[i] < 'a')
        ss[i] = 'A';
      else
        ss[i] = 'a';
    }
  }
  cout << ss << endl;
  return 0;
}
