#include <bits/stdc++.h>
using namespace std;
int n;
string D[100], L, l, C;
int R[100];
int main() {
  for (int i = 0; i < 100; ++i) {
    R[i] = 0;
  }
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> D[i];
    for (int j = 0; j < D[i].size(); ++j) {
      D[i][j] = tolower(D[i][j]);
    }
  }
  cin >> L;
  cin >> C;
  for (int i = 0; i < L.size(); ++i) l += tolower(L[i]);
  for (int i = 0; i < L.size(); ++i) {
    for (int j = 0; j < n; ++j) {
      if (D[j] == l.substr(i, D[j].size())) {
        for (int k = 0; k < D[j].size(); ++k) {
          R[i + k] = 1;
        }
      }
    }
  }
  for (int i = 0; i < L.size(); ++i) {
    if (R[i]) {
      if (tolower(L[i]) == C[0]) {
        if (isupper(L[i])) {
          L[i] = (L[i] == 'A') ? 'B' : 'A';
        } else {
          L[i] = (L[i] == 'a') ? 'b' : 'a';
        }
      } else {
        if (isupper(L[i])) {
          L[i] = toupper(C[0]);
        } else {
          L[i] = C[0];
        }
      }
    }
  }
  cout << L << endl;
  return 0;
}
