#include <bits/stdc++.h>
using namespace std;
int n;
char anjing;
string line, word, s[105];
int check(int id) {
  int res = 0;
  for (int i = 0; i < n; i++) {
    if (id + s[i].size() <= word.size() &&
        word.substr(id, s[i].size()) == s[i]) {
      res = max(res, (int)s[i].size());
    }
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    for (int j = 0; j < s[i].size(); j++) {
      s[i][j] = tolower(s[i][j]);
    }
  }
  cin >> line >> anjing;
  word = line;
  for (int i = 0; i < word.size(); i++) {
    word[i] = tolower(word[i]);
  }
  bitset<105> change;
  for (int i = 0; i < word.size(); i++) {
    int need = check(i);
    for (int j = i; j < i + need; j++) {
      change[j] = 1;
    }
  }
  for (int i = 0; i < word.size(); i++) {
    if (change[i]) {
      if (word[i] == anjing) {
        if (anjing == 'a')
          word[i] = 'b';
        else
          word[i] = 'a';
      } else {
        word[i] = anjing;
      }
    }
    if (isupper(line[i])) {
      word[i] = toupper(word[i]);
    }
  }
  cout << word << '\n';
  return 0;
}
