#include <bits/stdc++.h>
using namespace std;
int n, m;
int k;
bool debug = false;
int bl[103];
int main() {
  cin >> n;
  string s, a[n], ss, S, let;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    transform(a[i].begin(), a[i].end(), a[i].begin(), ::tolower);
  }
  cin >> S >> let;
  ss.resize(S.size());
  transform(S.begin(), S.end(), ss.begin(), ::tolower);
  for (int i = 0; i < n; i++) {
    long long pos = ss.find(a[i]);
    while (pos != string::npos) {
      for (int j = 0; j < a[i].size(); j++) {
        bl[j + pos] = 1;
      }
      pos = ss.find(a[i], pos + 1);
    }
  }
  string ans = "";
  for (int i = 0; i < ss.size(); i++) {
    if (bl[i]) {
      if (ss[i] == let[0]) {
        if (ss[i] != 'a') {
          if (isupper(S[i]))
            ans += 'A';
          else
            ans += 'a';
        } else {
          if (isupper(S[i]))
            ans += 'B';
          else
            ans += 'b';
        }
        continue;
      }
      if (isupper(S[i]))
        ans += toupper(let[0]);
      else
        ans += let;
    } else {
      ans += S[i];
    }
  }
  puts(ans.c_str());
  return 0;
}
