#include <bits/stdc++.h>
using namespace std;
set<string> dict;
string s, print;
char L;
string ToLower(string a) {
  for (int i = 0; i < a.size(); i++)
    if (isupper(a[i])) a[i] -= 'A' - 'a';
  return a;
}
int main() {
  int n;
  cin >> n;
  while (n--) {
    string temp;
    cin >> temp;
    dict.insert(ToLower(temp));
  }
  cin >> s >> L;
  print = s;
  tolower(L);
  for (int i = 0; i < s.size(); i++) {
    string temp = "";
    set<string>::iterator it;
    for (int j = i; j < s.size(); j++) {
      temp += s[j];
      it = dict.find(ToLower(temp));
      if (it != dict.end()) {
        for (int k = i; k <= j; k++) {
          if (isupper(s[k])) {
            if (tolower(s[k]) == L && L != 'a')
              print[k] = 'A';
            else if (tolower(s[k]) == L && L == 'a')
              print[k] = 'B';
            else if (tolower(s[k]) != L)
              print[k] = toupper(L);
          } else {
            if (s[k] == L && L != 'a')
              print[k] = 'a';
            else if (s[k] == L && L == 'a')
              print[k] = 'b';
            else if (s[k] != L)
              print[k] = L;
          }
        }
      }
    }
  }
  cout << print;
  return 0;
}
