#include <bits/stdc++.h>
using namespace std;
string toLower(string s) {
  for (int i = 0; i < s.size(); i++) {
    s[i] = tolower(s[i]);
  }
  return s;
}
int main() {
  int n;
  scanf("%d", &n);
  vector<string> s(n);
  set<string> forbidden;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    forbidden.insert(toLower(s[i]));
  }
  string t;
  cin >> t;
  int m = t.size();
  vector<bool> canReplace(m);
  for (int i = 0; i < m; i++) {
    for (int j = i; j < m; j++) {
      string shift = toLower(t.substr(i, j - i + 1));
      if (forbidden.count(shift)) {
        for (int k = i; k <= j; k++) {
          canReplace[k] = true;
        }
      }
    }
  }
  char c;
  cin >> c;
  c = tolower(c);
  for (int i = 0; i < m; i++) {
    if (canReplace[i]) {
      if (tolower(t[i]) != c) {
        if (isupper(t[i])) {
          cout << (char)toupper(c);
        } else {
          cout << (char)tolower(c);
        }
      } else {
        if (c == 'a') {
          if (isupper(t[i])) {
            cout << 'B';
          } else {
            cout << 'b';
          }
        } else {
          if (isupper(t[i])) {
            cout << 'A';
          } else {
            cout << 'a';
          }
        }
      }
    } else {
      cout << t[i];
    }
  }
  cout << endl;
}
