#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  vector<string> vs(n);
  for (long long int i = 0; i < n; i++) {
    cin >> vs[i];
    for (long long int j = 0; j < vs[i].size(); j++) {
      if (vs[i][j] >= 'A' && vs[i][j] <= 'Z') {
        vs[i][j] = vs[i][j] - 'A' + 'a';
      }
    }
  }
  string s;
  cin >> s;
  long long m = s.size();
  vector<bool> capital(m, 0);
  for (long long int i = 0; i < m; i++) {
    if (s[i] >= 'A' && s[i] <= 'Z') {
      capital[i] = 1;
      s[i] = s[i] - 'A' + 'a';
    }
  }
  char letter;
  cin >> letter;
  vector<bool> toChange(m, 0);
  for (long long int i = 0; i < m; i++) {
    for (long long int j = 0; j < n; j++) {
      if (i + vs[j].size() - 1 < m && s.substr(i, vs[j].size()) == vs[j]) {
        for (long long int k = i; k < i + vs[j].size(); k++) toChange[k] = 1;
      }
    }
  }
  for (long long int i = 0; i < m; i++) {
    if (toChange[i] == 1 && s[i] == letter) {
      if (letter == 'a')
        s[i] = 'b';
      else
        s[i] = 'a';
    } else if (toChange[i] == 1)
      s[i] = letter;
    if (capital[i]) {
      s[i] = s[i] - 'a' + 'A';
    }
  }
  cout << s;
  return 0;
}
