#include <bits/stdc++.h>
#pragma warning(disable : 4786)
using namespace std;
string words[105], w, ch;
char str[1005];
int change[105];
int main() {
  int i, j, k, tests, cs = 0, n, l;
  cin >> n;
  for (i = 0; i < n; i++) {
    scanf("%s", str);
    words[i] = str;
  }
  cin >> w >> ch;
  l = w.size();
  for (i = 0; i < l; i++) {
    int r = -1;
    for (j = 0; j < n; j++) {
      int l2 = words[j].size();
      for (k = 0; k < l2; k++)
        if (i + k >= l || tolower(w[i + k]) != tolower(words[j][k])) break;
      if (k == l2) r = ((r) > (i + l2 - 1) ? (r) : (i + l2 - 1));
    }
    for (j = i; j <= r; j++) change[j] = 1;
  }
  string ans = w;
  for (i = 0; i < l; i++) {
    if (change[i] == 0) continue;
    if (isupper(w[i])) {
      char to = toupper(ch[0]);
      if (w[i] != to)
        ans[i] = toupper(ch[0]);
      else {
        if (to != 'A')
          ans[i] = 'A';
        else
          ans[i] = 'B';
      }
    } else {
      char to = tolower(ch[0]);
      if (w[i] != to)
        ans[i] = tolower(ch[0]);
      else {
        if (to != 'a')
          ans[i] = 'a';
        else
          ans[i] = 'b';
      }
    }
  }
  printf("%s\n", ans.c_str());
  return 0;
}
