#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using pi = pair<int, int>;
const int mod = 1e9 + 7;
const ll inf = ll(1e18);
const double PI = acos(-1), eps = 1e-9;
const int mxn = 1e2, mxa = 100;
int n;
string w, second[mxn];
char c;
void solve() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> second[i];
    for (char &ch : second[i]) ch = tolower(ch);
  }
  cin >> w >> c;
  string ans = w, wlower = w;
  for (char &ch : wlower) ch = tolower(ch);
  for (int i = 0; i < (int)(w).size(); ++i) {
    for (int j = 0; j < n; ++j) {
      if (i + (int)(second[j]).size() - 1 >= (int)(w).size() ||
          wlower.substr(i, (int)(second[j]).size()) != second[j])
        continue;
      for (int k = i; k < i + (int)(second[j]).size(); ++k) {
        if (wlower[k] != c)
          ans[k] = isupper(w[k]) ? toupper(c) : c;
        else {
          if (wlower[k] == 'a')
            ans[k] = isupper(ans[k]) ? 'B' : 'b';
          else
            ans[k] = isupper(ans[k]) ? 'A' : 'a';
        }
      }
    }
  }
  cout << ans << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t;
  t = 1;
  while (t--) solve();
}
