#include <bits/stdc++.h>
using namespace std;
int n;
char s[105], f[105][105], letter[2];
bool vst[105];
int idx(char c) {
  if (c <= 'Z') return c - 'A';
  return c - 'a';
}
bool equal(char c1, char c2) { return idx(c1) == idx(c2); }
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%s", f[i]);
  scanf("%s%s", s, letter);
  letter[0] = idx(letter[0]);
  for (int i = 0; s[i];) {
    bool found = false;
    if (vst[i]) found = true;
    for (int j = 0; j < n; j++) {
      bool flag = true;
      int k;
      for (k = 0; f[j][k] && flag; k++) {
        if (!equal(s[i + k], f[j][k])) flag = false;
      }
      if (f[j][k]) flag = false;
      if (flag) {
        for (int l = i; l < i + k; l++) vst[l] = true;
        found = true;
      }
    }
    if (found) {
      if (idx(s[i]) != letter[0]) {
        if (s[i] <= 'Z')
          printf("%c", letter[0] + 'A');
        else
          printf("%c", letter[0] + 'a');
      } else if (idx(s[i]) != 0) {
        if (s[i] <= 'Z')
          printf("A");
        else
          printf("a");
      } else {
        if (s[i] <= 'Z')
          printf("B");
        else
          printf("b");
      }
      i++;
    } else
      printf("%c", s[i++]);
  }
  printf("\n");
  return 0;
}
