#include <bits/stdc++.h>
using namespace std;
char s[110][110];
char w[110];
int main() {
  int n, i;
  cin >> n;
  for (i = 0; i < n; i++) {
    scanf("%s", s[i]);
  }
  scanf("%s ", w);
  char c;
  scanf("%c", &c);
  int j, k, a[110] = {0};
  for (i = 0; i < n; i++) {
    int l = strlen(s[i]);
    for (j = 0; w[j]; j++) {
      for (k = 0; k < l; k++) {
        if (tolower(s[i][k]) != tolower(w[j + k])) break;
      }
      if (k < l) continue;
      for (k = 0; k < l; k++) a[j + k] = 1;
    }
  }
  for (i = 0; w[i]; i++) {
    if (!a[i]) continue;
    if (islower(w[i]))
      w[i] = (w[i] == tolower(c)) ? 'a' + (tolower(c) == 'a') : tolower(c);
    else
      w[i] = (w[i] == toupper(c)) ? 'A' + (toupper(c) == 'A') : toupper(c);
  }
  puts(w);
  return 0;
}
