#include <bits/stdc++.h>
using namespace std;
int x1, x2, n, use[110], i, j, k, l, chang[110];
char c, biao[1100], s[110][110];
bool can(int d, int a) {
  int x1, x2, i;
  if (d + chang[a] > l) return false;
  for (i = d; i < d + chang[a]; i++) {
    x1 = int(biao[i]);
    if (x1 >= 97) x1 += -32;
    x2 = int(s[a][i - d]);
    if (x2 >= 97) x2 += -32;
    if (x1 != x2) return false;
  }
  return true;
}
int main() {
  scanf("%d\n", &n);
  for (i = 1; i <= n; i++) gets(s[i]), chang[i] = strlen(s[i]);
  gets(biao);
  l = strlen(biao);
  scanf("%c", &c);
  for (i = 0; i < l; i++)
    for (j = 1; j <= n; j++)
      if (can(i, j))
        for (k = i; k < chang[j] + i; k++) use[k] = 1;
  for (i = 0; i < l; i++) {
    if (use[i] == 0) {
      printf("%c", biao[i]);
      continue;
    }
    x1 = biao[i];
    if (x1 >= 97) x1 += -32;
    x2 = c;
    if (x2 >= 97) x2 += -32;
    if (x1 == x2) {
      k = biao[i];
      if (k < 97)
        k = 65;
      else
        k = 97;
      if (x1 == 65 || x1 == 97)
        printf("%c", biao[i] + 1);
      else
        printf("%c", k);
      continue;
    }
    if (biao[i] < 97)
      printf("%c", c - 32);
    else
      printf("%c", c);
  }
  printf("\n");
}
