#include <bits/stdc++.h>
using namespace std;
string sent, sent2, out;
string word[105], word2[105];
int sz[105];
vector<int> idx[105];
int main() {
  int n;
  string tmp;
  char letter;
  while (cin >> n) {
    for (int i = 0; i < (n); i++) {
      cin >> word[i];
      sz[i] = word[i].length();
      word2[i] = word[i];
      for (int j = 0; j < (sz[i]); j++) {
        word2[i][j] = tolower(word2[i][j]);
      }
    }
    cin >> sent;
    cin >> tmp;
    letter = tmp[0];
    out = "";
    for (int i = 0; i < (n); i++) {
      idx[i].clear();
    }
    int len = (int)sent.length();
    sent2 = sent;
    for (int j = 0; j < (len); j++) {
      sent2[j] = tolower(sent2[j]);
    }
    for (int i = 0; i < (len); i++) {
      for (int j = 0; j < (n); j++) {
        int a = i, b = 0;
        while (a < len && b < sz[j] && sent2[a] == word2[j][b]) {
          a++;
          b++;
        }
        if (b >= sz[j]) {
          idx[j].push_back(i);
        }
      }
    }
    bool fin;
    for (int i = 0; i < (len); i++) {
      out += sent[i];
      fin = false;
      for (int j = 0; j < (n); j++) {
        for (int k = 0; k < (idx[j].size()); k++) {
          if (i >= idx[j][k] && i < idx[j][k] + sz[j]) {
            fin = true;
            break;
          }
        }
        if (fin) break;
      }
      if (fin) {
        if (out[i] >= 'A' && out[i] <= 'Z') {
          if (out[i] == toupper(letter)) {
            if (out[i] == 'A')
              out[i] = 'B';
            else
              out[i] = 'A';
          } else
            out[i] = toupper(letter);
        } else {
          if (out[i] == tolower(letter)) {
            if (out[i] == 'a')
              out[i] = 'b';
            else
              out[i] = 'a';
          } else
            out[i] = tolower(letter);
        }
      }
    }
    cout << out << endl;
  }
  return 0;
}
