#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const int N = 404;
string p[N], t;
int rng[N], z[N], cap[N];
char c, d;
void zfunc(const string &s, int x) {
  int n = s.length();
  memset(z, 0, sizeof z);
  for (int i = 1, l = 0, r = 0; i < n; ++i) {
    if (i <= r) z[i] = min(r - i + 1, z[i - l]);
    while (i + z[i] < n && s[z[i]] == s[i + z[i]]) ++z[i];
    if (i + z[i] - 1 > r) l = i, r = i + z[i] - 1;
  }
  for (int i = x + 1; i < n; ++i) {
    if (z[i] >= x) {
      rng[i - x - 1]++;
      rng[i + z[i] - x - 1]--;
    }
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> p[i];
    transform(p[i].begin(), p[i].end(), p[i].begin(), ::tolower);
  }
  cin >> t >> c;
  for (int i = 0; i < t.size(); ++i) {
    cap[i] = t[i] & 32;
  }
  transform(t.begin(), t.end(), t.begin(), ::tolower);
  c |= 32;
  d = (c == 'a') ? 'b' : 'a';
  for (int i = 0; i < n; ++i) {
    zfunc(p[i] + "#" + t, p[i].size());
  }
  for (int i = 0; i < t.size(); ++i) {
    if (i) rng[i] += rng[i - 1];
    if (rng[i]) t[i] = (t[i] == c) ? d : c;
    if (!cap[i]) t[i] &= ~32;
    if (cap[i]) t[i] |= 32;
  }
  cout << t;
}
