#include <bits/stdc++.h>
using namespace std;
long long n, i, j, ans = 0;
string s[1000], w;
char t;
long long a[1000000];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> s[i];
    for (j = 0; j < s[i].length(); j++)
      if (isupper(s[i][j])) s[i][j] = tolower(s[i][j]);
  }
  cin >> w;
  cin >> t;
  string W = w;
  for (i = 0; i < W.length(); i++)
    if (isupper(W[i])) W[i] = tolower(W[i]);
  for (i = 1; i <= n; i++) {
    for (j = 0; j < w.length(); j++) {
      if (W[j] == s[i][0]) {
        long long k = 0;
        for (k = 0; k < s[i].length(); k++) {
          if (s[i][k] != W[j + k]) break;
        }
        if (k == (long long)s[i].length()) {
          for (long long k = 0; k < s[i].length(); k++) a[k + j] = 1;
        }
      }
    }
  }
  for (i = 0; i < w.length(); i++) {
    if (a[i]) {
      if (tolower(w[i]) == t) {
        if (isupper(w[i])) {
          if (t == 'a')
            w[i] = 'B';
          else
            w[i] = 'A';
        } else {
          if (t == 'a')
            w[i] = 'b';
          else
            w[i] = 'a';
        }
      } else {
        if (isupper(w[i]))
          w[i] = toupper(t);
        else
          w[i] = t;
      }
    }
  }
  cout << w;
}
