#include <bits/stdc++.h>
using namespace std;
string A;
string a[100];
int isc[1000] = {};
int isn[1000] = {};
char c, cc;
int main() {
  int i, n, j, k;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    cin >> a[i];
    int l = a[i].size();
    for (j = 0; j < l; j++)
      if (a[i][j] <= 'Z') a[i][j] += ('a' - 'A');
  }
  cin >> A;
  cin >> c;
  if (c <= 'Z')
    cc = c + ('a' - 'A');
  else
    cc = c - ('a' - 'A');
  int l = A.size();
  for (i = 0; i < l; i++) {
    if (A[i] <= 'Z') {
      isc[i] = 1;
      A[i] += ('a' - 'A');
    }
  }
  for (i = 0; i < n; i++) {
    string now = a[i];
    int x = now.size();
    for (j = 0; j <= l - x; j++) {
      for (k = 0; k < x; k++)
        if (A[j + k] != now[k]) break;
      if (k == x)
        for (k = 0; k < x; k++) isn[j + k] = 1;
    }
  }
  for (i = 0; i < l; i++) {
    if (isn[i]) {
      if (A[i] == c || A[i] == cc) {
        A[i] = 'a';
        if (max(c, cc) == 'a') A[i] = 'b';
      } else
        A[i] = max(c, cc);
    }
  }
  for (i = 0; i < l; i++)
    if (isc[i]) A[i] -= ('a' - 'A');
  cout << A;
  printf("\n");
  return 0;
}
