#include <bits/stdc++.h>
using namespace std;
bool comp(string a, string b) {
  for (int(i) = (int)(0); (i) < (int)(a.size()); ++(i)) a[i] = tolower(a[i]);
  for (int(i) = (int)(0); (i) < (int)(b.size()); ++(i)) b[i] = tolower(b[i]);
  return a == b;
}
int main() {
  int n;
  cin >> n;
  vector<string> seq(n);
  for (int(i) = (int)(0); (i) < (int)(n); ++(i)) cin >> seq[i];
  string s;
  cin >> s;
  char x;
  cin >> x;
  int m = s.size();
  vector<int> w(m, 0);
  for (int(i) = (int)(0); (i) < (int)(m); ++(i))
    for (int(j) = (int)(i); (j) < (int)(m); ++(j)) {
      string sub = s.substr(i, j - i + 1);
      bool flag = false;
      for (int(k) = (int)(0); (k) < (int)(n); ++(k))
        if (comp(sub, seq[k])) {
          flag = true;
          break;
        }
      if (flag) {
        for (int k = i; k <= j; ++k) w[k] = 1;
      }
    }
  string ans = s;
  for (int(i) = (int)(0); (i) < (int)(m); ++(i))
    if (w[i] == 1) {
      if (tolower(s[i]) != x) {
        if ('A' <= s[i] && s[i] <= 'Z')
          ans[i] = toupper(x);
        else
          ans[i] = x;
      } else {
        if ('A' <= s[i] && s[i] <= 'Z') {
          if (x == 'a')
            ans[i] = 'B';
          else
            ans[i] = 'A';
        } else {
          if (x == 'a')
            ans[i] = 'b';
          else
            ans[i] = 'a';
        }
      }
    }
  cout << ans << endl;
  return 0;
}
