#include <bits/stdc++.h>
using namespace std;
string lower(string second) {
  for (int i = 0; i < second.size(); i++)
    if (second[i] >= 'A' && second[i] <= 'Z') second[i] = second[i] - 'A' + 'a';
  return second;
}
char reg(char c, char t) {
  if (c >= 'A' && c <= 'Z') return t - 'a' + 'A';
  return t;
}
string second, a[105], sl;
bool u[105];
int n;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    a[i] = lower(a[i]);
  }
  char let;
  cin >> second >> let;
  sl = lower(second);
  for (int i = 0; i < second.size(); i++)
    for (int j = 0; j < n; j++)
      if (i + a[j].size() <= second.size() &&
          sl.substr(i, a[j].size()) == a[j]) {
        for (int k = i; k < i + a[j].size(); k++) u[k] = true;
      }
  for (int i = 0; i < second.size(); i++)
    if (u[i]) {
      if (sl[i] == let) {
        if (sl[i] == 'a')
          second[i] = reg(second[i], 'b');
        else
          second[i] = reg(second[i], 'a');
      } else
        second[i] = reg(second[i], let);
    }
  cout << second;
  return 0;
}
