#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000 + 10;
char st[maxn], c[maxn];
char b[maxn][maxn];
int n;
bool flag[maxn];
bool cmp(int a, int b, char s1[], char s2[], int n) {
  for (int i = 0; i < n; i++) {
    char c1 = s1[a + i];
    if (c1 >= 'A' && c1 <= 'Z') c1 = c1 - 'A' + 'a';
    char c2 = s2[b + i];
    if (c2 >= 'A' && c2 <= 'Z') c2 = c2 - 'A' + 'a';
    if (c1 != c2) return 0;
  }
  return 1;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%s", b[i]);
  scanf("%s", st);
  scanf("%s", c);
  for (int i = 0; st[i]; i++) {
    bool ok = 0;
    for (int k = 0; !ok && k < n; k++) {
      int len = strlen(b[k]);
      for (int j = 0; !ok && j <= i; j++)
        if (j + len - 1 >= i) ok |= cmp(j, 0, st, b[k], len);
    }
    flag[i] = ok;
  }
  if (c[0] >= 'a' && c[0] <= 'z') c[0] = c[0] - 'a' + 'A';
  for (int i = 0; st[i]; i++)
    if (flag[i]) {
      if (st[i] >= 'A' && st[i] <= 'Z') {
        if (st[i] == c[0]) {
          if (st[i] == 'A')
            st[i] = 'B';
          else
            st[i] = 'A';
        } else
          st[i] = c[0];
      } else {
        if (st[i] == c[0] - 'A' + 'a') {
          if (st[i] == 'a')
            st[i] = 'b';
          else
            st[i] = 'a';
        } else
          st[i] = c[0] - 'A' + 'a';
      }
    }
  printf("%s", st);
}
