#include <bits/stdc++.h>
int n;
int len[110];
bool fac[110];
char fob[110][110];
char str[110];
char tpp[110];
char ch[2];
char ans[110];
int main() {
  while (scanf("%d", &n) != EOF) {
    for (int i = 0; i < n; ++i) {
      scanf("%s", fob[i]);
      len[i] = strlen(fob[i]);
      for (int j = 0; j < len[i]; ++j) fob[i][j] = tolower(fob[i][j]);
    }
    scanf("%s", str);
    scanf("%s", ch);
    ch[0] = tolower(ch[0]);
    strcpy(tpp, str);
    memset(fac, false, sizeof(fac));
    int m = strlen(str);
    for (int i = 0; i < m; ++i) str[i] = tolower(str[i]);
    for (int i = 0; i < m; ++i)
      for (int j = 0; j < n; ++j)
        if (!strncmp(str + i, fob[j], len[j])) {
          for (int k = 0; k < len[j]; ++k) fac[i + k] = true;
        }
    for (int i = 0; i < m; ++i) {
      if (!fac[i]) {
        printf("%c", tpp[i]);
      } else {
        if (str[i] == ch[0]) {
          if (ch[0] == 'a') {
            if (tpp[i] >= 'A' && tpp[i] <= 'Z')
              printf("B");
            else
              printf("%c", 'b');
          } else {
            if (tpp[i] >= 'A' && tpp[i] <= 'Z')
              printf("A");
            else
              printf("%c", 'a');
          }
        } else {
          if (tpp[i] >= 'A' && tpp[i] <= 'Z')
            printf("%c", toupper(ch[0]));
          else
            printf("%c", tolower(ch[0]));
        }
      }
    }
    puts("");
  }
  return 0;
}
