#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const int N = 105;
string s[N], ss[N], w, ww;
bool vis[N];
char str;
string change(string x) {
  for (int i = 0; i < x.length(); i++) {
    if (x[i] >= 'A' && x[i] <= 'Z') x[i] += 32;
  }
  return x;
}
int main() {
  std::ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    ss[i] = change(s[i]);
  }
  cin >> w >> str;
  ww = change(w);
  if (str >= 'A' && str <= 'Z') str += 32;
  int l = ww.length();
  for (int i = 0; i < l; i++) {
    for (int k = 0; k < n; k++) {
      if (l - s[k].length() + 1 >= i && ww.substr(i, ss[k].length()) == ss[k]) {
        for (int j = i; j < i + ss[k].length(); j++) vis[j] = 1;
      }
    }
  }
  for (int i = 0; i < l; i++) {
    if (vis[i]) {
      if (ww[i] == str) {
        char tmp = 'a';
        if (ww[i] == 'a') tmp = 'b';
        if (w[i] >= 'A' && w[i] <= 'Z')
          w[i] = tmp - 32;
        else
          w[i] = tmp;
      } else {
        if (w[i] >= 'A' && w[i] <= 'Z')
          w[i] = str - 32;
        else
          w[i] = str;
      }
    }
  }
  cout << w << endl;
}
