#include <bits/stdc++.h>
const int N = 100003;
using namespace std;
struct bohr {
  map<char, int> DALSHE;
  bool leaf;
};
bohr tt[N * 2];
int sz;
char t;
string s;
int a[N], sw[N], n;
void add(string s) {
  int v = 1;
  for (int i = 0; i < s.size(); ++i) {
    if (tt[v].DALSHE[s[i]])
      v = tt[v].DALSHE[s[i]];
    else {
      tt[v].DALSHE[s[i]] = ++sz;
      v = sz;
    }
  }
  tt[v].leaf = 1;
}
void go(int l) {
  int v = 1;
  int sl = l;
  for (;;) {
    if (tt[v].DALSHE[s[l]]) {
      v = tt[v].DALSHE[s[l]];
      l++;
    } else
      break;
    if (tt[v].leaf) {
      for (int j = sl; j < l; j++) a[j] = 1;
    }
  }
}
int main() {
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  cin >> n;
  sz = 1;
  for (int i = 1; i <= n; i++) {
    cin >> s;
    for (int i = 0; i < s.size(); i++)
      if ('A' <= s[i] && s[i] <= 'Z') s[i] ^= 32;
    add(s);
  }
  cin >> s;
  s.push_back('#');
  cin >> t;
  if ('A' <= t && t <= 'Z') t ^= 32;
  for (int i = 0; i + 1 < s.size(); i++) {
    if ('A' <= s[i] && s[i] <= 'Z') {
      sw[i] = 1;
      s[i] ^= 32;
    }
  }
  for (int i = 0; i + 1 < s.size(); i++) {
    go(i);
  }
  for (int i = 0; i + 1 < s.size(); i++) {
    if (a[i] == 1) {
      if (s[i] == t) {
        for (int ch = 'a'; ch <= 'z'; ch++)
          if (s[i] != ch) {
            s[i] = ch;
            break;
          }
      } else
        s[i] = t;
    }
    if (sw[i]) s[i] ^= 32;
    cout << s[i];
  }
}
