#include <bits/stdc++.h>
using namespace std;
const long long inf = (long long)1 << 50;
string s, pat[1005];
char tar;
int n;
char toUp(char ch) {
  if (ch >= 'a' && ch <= 'z')
    return ch - ('a' - 'A');
  else
    return ch;
}
char toLe(char ch) {
  if (ch >= 'A' && ch <= 'Z') return ch + ('a' - 'A');
  return ch;
}
bool same(string s1, string s2) {
  for (int i = 0; i < s1.length(); i++) {
    char ch1 = toUp(s1[i]);
    char ch2 = toUp(s2[i]);
    if (ch1 != ch2) return false;
  }
  return true;
}
char findMin(char ch) {
  if (ch >= 'a' && ch <= 'z') {
    if (ch == 'a') return 'b';
    return 'a';
  } else {
    if (ch == 'A') return 'B';
    return 'A';
  }
}
int main() {
  while (cin >> n) {
    for (int i = 1; i <= n; i++) cin >> pat[i];
    cin >> s;
    cin >> tar;
    bool vst[1005] = {false};
    for (int i = 1; i <= n; i++) {
      for (int j = 0; j + pat[i].length() <= s.length(); j++) {
        if (same(pat[i], s.substr(j, j + pat[i].length()))) {
          for (int k = 0; k < pat[i].length(); k++) vst[j + k] = true;
        }
      }
    }
    for (int i = 0; i < s.length(); i++) {
      if (vst[i] == false) continue;
      if (s[i] >= 'a' && s[i] <= 'z') {
        if (s[i] == toLe(tar))
          s[i] = findMin(s[i]);
        else
          s[i] = toLe(tar);
      } else {
        if (s[i] == toUp(tar))
          s[i] = findMin(s[i]);
        else
          s[i] = toUp(tar);
      }
    }
    cout << s << endl;
  }
}
