#include <bits/stdc++.h>
using namespace std;
const int maxn = 105;
char buf[maxn][maxn];
int L[maxn];
char s[maxn], d[maxn];
bool visit[maxn];
int main() {
  ios::sync_with_stdio(false);
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%s", buf[i]);
    L[i] = strlen(buf[i]);
    for (int j = 0; j < L[i]; ++j)
      if (islower(buf[i][j])) buf[i][j] = buf[i][j] - 'a' + 'A';
  }
  scanf("%s", s);
  strcpy(d, s);
  int slen = strlen(s);
  for (int j = 0; j < slen; ++j)
    if (islower(s[j])) s[j] = s[j] - 'a' + 'A';
  int l, r;
  for (int i = 0; i < slen; ++i) {
    r = -1;
    for (int j = 0; j < n; ++j) {
      if (strncmp(s + i, buf[j], L[j]) == 0) {
        r = max(r, L[j]);
      }
    }
    if (r > 0) {
      for (int j = 0; j < r; ++j) visit[i + j] = true;
    }
  }
  char op[5];
  scanf("%s", op);
  char c, C;
  if (islower(op[0])) {
    c = op[0];
    C = c - 'a' + 'A';
  } else {
    C = op[0];
    c = C - 'A' + 'a';
  }
  for (int i = 0; i < slen; ++i) {
    if (!visit[i]) continue;
    if (islower(d[i])) {
      if (d[i] == c) {
        d[i] = (d[i] == 'a') ? 'b' : 'a';
      } else {
        d[i] = c;
      }
    } else {
      if (d[i] == C) {
        d[i] = (d[i] == 'A') ? 'B' : 'A';
      } else {
        d[i] = C;
      }
    }
  }
  puts(d);
  return 0;
}
