#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<string> str(n);
  for (int(i) = 0; (i) < (n); ++(i)) cin >> str[i];
  string s;
  cin >> s;
  int len = ((int)(s).size());
  char ch;
  cin >> ch;
  char best = 'a';
  if (best == ch) best = 'b';
  vector<int> a(len, 0);
  vector<int> b(len, 0);
  for (int(i) = 0; (i) < (len); ++(i))
    if (s[i] >= 'A' && s[i] <= 'Z') {
      s[i] = s[i] - 'A' + 'a';
      a[i] = 1;
    }
  for (int(i) = 0; (i) < (n); ++(i))
    for (int(j) = 0; (j) < (((int)(str[i]).size())); ++(j))
      if (str[i][j] >= 'A' && str[i][j] <= 'Z')
        str[i][j] = str[i][j] - 'A' + 'a';
  for (int(i) = 0; (i) < (n); ++(i)) {
    int m = ((int)(str[i]).size());
    for (int(j) = 0; (j) < (len); ++(j))
      if (s.substr(j, m) == str[i]) {
        for (int(k) = 0; (k) < (m); ++(k)) b[j + k] = 1;
      }
  }
  for (int(i) = 0; (i) < (len); ++(i))
    if (b[i]) {
      if (s[i] != ch)
        s[i] = ch;
      else
        s[i] = best;
    }
  for (int(i) = 0; (i) < (len); ++(i))
    if (a[i])
      cout << char(s[i] - 'a' + 'A');
    else
      cout << s[i];
  cout << endl;
  return 0;
}
