#include <bits/stdc++.h>
using namespace std;
string S[150];
string letter;
bool change[150];
int delta(char a, char b) {
  a = tolower(a);
  b = tolower(b);
  return a - b;
}
string make_lower(string s) {
  string ans;
  int N = s.length();
  for (int i = 0; i < (N); i++) ans += tolower(s[i]);
  return ans;
}
int main() {
  int N;
  cin >> N;
  for (int i = 0; i < (N); i++) cin >> S[i], S[i] = make_lower(S[i]);
  string W;
  cin >> W;
  cin >> letter;
  string V = make_lower(W);
  memset(change, false, sizeof(change));
  int L = W.size();
  for (int i = 0; i < (N); i++) {
    int K = S[i].size();
    for (int j = 0; j < ((L - K + 1)); j++) {
      if (V.substr(j, K) == S[i]) {
        for (int k = 0; k < (K); k++) change[j + k] = true;
      }
    }
  }
  for (int i = 0; i < (L); i++) {
    if (!change[i]) continue;
    if (tolower(W[i]) == tolower(letter[0])) {
      if (letter[0] == 'a' || letter[0] == 'A') {
        W[i] += delta('B', W[i]);
      } else {
        W[i] += delta('A', W[i]);
      }
    } else {
      W[i] += delta(letter[0], W[i]);
    }
  }
  cout << W << endl;
}
