#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 9;
char f[105][105];
char s[105];
char letter[3];
void inline jeden() {
  int n;
  scanf("%d", &n);
  for (int i = 0, _ = (n); i < _; ++i) {
    scanf("%s", f[i]);
  }
  scanf("%s", s);
  scanf("%s", letter);
  bool cover[105] = {};
  int slen = strlen(s);
  for (int i = 0, _ = (n); i < _; ++i) {
    int flen = strlen(f[i]);
    for (int j = 0, _ = (slen); j < _; ++j) {
      if (j + flen <= slen) {
        if (strncasecmp(f[i], s + j, flen) == 0) {
          for (int k = 0, _ = (flen); k < _; ++k) {
            cover[j + k] = true;
          }
        }
      }
    }
  }
  char up, low;
  if (letter[0] == 'a' || letter[0] == 'A') {
    up = 'B';
    low = 'b';
  } else {
    up = 'A';
    low = 'a';
  }
  for (int i = 0, _ = (slen); i < _; ++i) {
    if (cover[i]) {
      if (strncasecmp(s + i, letter, 1) == 0) {
        if (isupper(s[i])) {
          s[i] = up;
        } else {
          s[i] = low;
        }
      } else {
        if (isupper(s[i])) {
          s[i] = toupper(letter[0]);
        } else {
          s[i] = tolower(letter[0]);
        }
      }
    }
  }
  puts(s);
}
int main() { jeden(); }
