#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
int main() {
  string w;
  char lucky;
  vector<string> v;
  int n;
  cin >> n;
  while (n--) {
    string s;
    cin >> s;
    v.push_back(s);
  }
  cin >> w;
  cin >> lucky;
  string w2 = w;
  for (int i = 0; i < (int)v.size(); i++) {
    string s = v[i];
    for (int j = 0; j < (int)w.size(); j++) {
      string sub = w.substr(j, (int)s.size());
      int ok = 1;
      for (int i = 0; i < (int)s.size(); i++) {
        if ((int)s[i] == (int)sub[i] || (int)s[i] == (int)sub[i] + 32 ||
            (int)s[i] + 32 == (int)sub[i]) {
          continue;
        } else {
          ok = 0;
        }
      }
      if (ok) {
        for (int k = j; k < j + (int)sub.size(); k++) {
          if ((int)w[k] >= 97) {
            if ((int)lucky < 97) {
              lucky = char(lucky + 32);
            }
            if (w[k] != lucky) {
              w2[k] = lucky;
            } else if (lucky == 'a') {
              w2[k] = 'b';
            } else {
              w2[k] = 'a';
            }
          } else {
            if ((int)lucky >= 97) {
              lucky = char(lucky - 32);
            }
            if (w[k] != lucky) {
              w2[k] = lucky;
            } else if (lucky == 'A') {
              w2[k] = 'B';
            } else {
              w2[k] = 'A';
            }
          }
        }
      }
    }
  }
  cout << w2 << endl;
  return 0;
}
