#include <bits/stdc++.h>
using namespace std;
char a[105][105], s[105], res[105], letter, letter2, help[105];
int i, j, k, N, lens, lena[105];
int main() {
  scanf("%d", &N);
  gets(a[103]);
  for (i = 0; i < N; i++) {
    gets(a[i]);
    lena[i] = strlen(a[i]);
    for (j = 0; j < lena[i]; j++)
      if (a[i][j] >= 'a' && a[i][j] <= 'z') a[i][j] -= 32;
  }
  gets(s);
  lens = strlen(s);
  for (i = 0; i < lens; i++) {
    if (s[i] >= 'a' && s[i] <= 'z')
      help[i] = s[i] - 32;
    else
      help[i] = s[i];
  }
  scanf("%c", &letter);
  if (letter >= 'A' && letter <= 'Z')
    letter2 = letter + 32;
  else
    letter2 = letter - 32;
  if (letter < letter2) swap(letter, letter2);
  for (i = 0; i < lens; i++) {
    for (j = 0; j < N; j++) {
      if (memcmp(help + i, a[j], lena[j]) == 0) {
        for (k = i; k < i + lena[j]; k++) {
          if (s[k] != letter && s[k] != letter2) {
            if (s[k] >= 'a' && s[k] <= 'z')
              res[k] = letter;
            else
              res[k] = letter2;
          } else {
            if (s[k] >= 'a' && s[k] <= 'z')
              res[k] = letter == 'a' ? 'b' : 'a';
            else
              res[k] = letter2 == 'A' ? 'B' : 'A';
          }
        }
      }
    }
  }
  for (i = 0; i < lens; i++)
    if (res[i] == 0) res[i] = s[i];
  puts(res);
  return 0;
}
