#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  map<string, bool> m;
  string p;
  for (int i = 0; i < n; i++) {
    cin >> p;
    for (int j = 0; j < p.size(); j++)
      if ('A' <= p[j] && p[j] <= 'Z') p[j] += 32;
    m[p] = true;
  }
  string s;
  cin >> s;
  char ch;
  cin >> ch;
  int replace[s.size()];
  memset(replace, 0, sizeof(replace));
  for (int i = 0; i < s.size(); i++) {
    string tt;
    for (int j = i; j < s.size(); j++) {
      if ('A' <= s[j] && s[j] <= 'Z')
        tt += (s[j] + 32);
      else
        tt += s[j];
      if (m.find(tt) != m.end()) {
        for (int k = i; k <= j; k++) replace[k] = 1;
      }
    }
  }
  for (int i = 0; i < s.size(); i++) {
    if (replace[i]) {
      if (s[i] == ch || s[i] == ch - 32) {
        if (ch != 'a') {
          if ('A' <= s[i] && s[i] <= 'Z')
            s[i] = 'A';
          else
            s[i] = 'a';
        } else {
          if ('A' <= s[i] && s[i] <= 'Z')
            s[i] = 'B';
          else
            s[i] = 'b';
        }
      } else {
        if ('A' <= s[i] && s[i] <= 'Z')
          s[i] = ch - 32;
        else
          s[i] = ch;
      }
    }
  }
  cout << s << "\n";
}
