#include <bits/stdc++.h>
using namespace std;
struct pair_hash {
  template <class T1, class T2>
  std::size_t operator()(const std::pair<T1, T2> &p) const {
    auto h1 = std::hash<T1>{}(p.first);
    auto h2 = std::hash<T2>{}(p.second);
    return h1 ^ h2;
  }
};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<string> arr(105);
  int i, j, k;
  for (i = 0; i < n; i++) cin >> arr[i];
  string w, a, b;
  cin >> w;
  a = b = w;
  transform(a.begin(), a.end(), a.begin(), ::toupper);
  transform(b.begin(), b.end(), b.begin(), ::tolower);
  char letter;
  cin >> letter;
  vector<pair<int, int> > range;
  pair<int, int> temp;
  for (i = 0; i < n; i++) {
    for (j = 0; j < w.length(); j++) {
      if (a[j] == arr[i][0] || b[j] == arr[i][0]) {
        temp.first = j;
        temp.second = j + arr[i].length();
        int first = 0;
        for (k = 0; k < arr[i].length(); k++) {
          if (arr[i][k] != a[j + k] && arr[i][k] != b[j + k]) first = 1;
        }
        if (first == 0) range.push_back(temp);
      }
    }
  }
  vector<int> count(105, 0);
  for (i = 0; i < range.size(); i++) {
    for (j = range[i].first; j < range[i].second; j++) count[j]++;
  }
  char smallletter, bigletter;
  if (letter > 95) {
    smallletter = letter;
    bigletter = letter - 32;
  } else {
    bigletter = letter;
    smallletter = letter + 32;
  }
  for (i = 0; i < w.length(); i++) {
    if (count[i] > 0 && (w[i] == smallletter || w[i] == bigletter)) {
      if (w[i] > 95 && w[i] != 'a') {
        cout << 'a';
        continue;
      } else if (w[i] > 95) {
        cout << 'b';
        continue;
      }
      if (w[i] < 95 && w[i] != 'A')
        cout << 'A';
      else if (w[i] < 95)
        cout << 'B';
      continue;
    }
    if (count[i] > 0) {
      if (w[i] > 95) {
        cout << smallletter;
      } else {
        cout << bigletter;
      }
    } else
      cout << w[i];
  }
  return 0;
}
