#include <bits/stdc++.h>
using namespace std;
int T, m, n, q, w, mi, ma, cnt, t, fi, cc, e, r, z, x, an, sl;
char a[210][210];
char s[210], temp[10];
bool b[210];
int l[210];
char c;
bool ss(char x, char y) {
  if (tolower(x) == tolower(y)) return true;
  return false;
}
int main() {
  scanf("%d", &m);
  memset(a, 0, sizeof(a));
  memset(s, 0, sizeof(s));
  for (int i = 0; i < 210; i++) b[i] = false;
  for (int i = 0; i < m; i++) scanf("%s", a[i]), l[i] = (int)strlen(a[i]);
  scanf("%s", s);
  sl = (int)strlen(s);
  for (int i = 0; s[i]; i++) {
    for (int j = 0; j < m; j++) {
      if (i + l[j] <= sl) {
        fi = 0;
        for (int k = 0; k < l[j]; k++)
          if (!ss(s[i + k], a[j][k])) {
            fi = 1;
            break;
          }
        if (fi == 0)
          for (int k = i; k < i + l[j]; k++) b[k] = true;
      }
    }
  }
  gets(temp);
  scanf("%c", &c);
  for (int i = 0; i < sl; i++)
    if (b[i]) {
      if (ss(s[i], c)) {
        if (s[i] > 96)
          s[i] = ss(c, 'a') ? 'b' : 'a';
        else
          s[i] = ss(c, 'a') ? 'B' : 'A';
      } else {
        if (s[i] > 96)
          s[i] = tolower(c);
        else
          s[i] = toupper(c);
      }
    }
  puts(s);
  return 0;
}
