#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c* x) -> decltype(cerr << *x, 0);
template <class c>
char dud(...);
struct debug {
  template <class c>
  debug& operator<<(const c&) {
    return *this;
  }
};
const long long N = 1e5 + 5;
void lower(string& s) {
  long long n = s.length();
  for (long long i = 0; i < n; i++) {
    if (s[i] >= 65 && s[i] <= 90) s[i] += 32;
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  map<string, bool> mp;
  string s;
  for (long long i = 0; i < n; i++) {
    cin >> s;
    lower(s);
    mp[s] = true;
  }
  cin >> s;
  char c, C;
  cin >> c;
  if (c >= 65 && c <= 90) {
    C = c;
    c += 32;
  } else {
    C = c - 32;
  }
  char ch = 'a', CH = 'A';
  if (ch == c) ch = 'b';
  if (CH == C) CH = 'B';
  string ans;
  n = (long long)s.size();
  ans.resize(n, '-');
  for (long long i = 0; i < n; i++) {
    for (long long j = i; j < n; j++) {
      string t = s.substr(i, j - i + 1);
      lower(t);
      if (mp.find(t) != mp.end()) {
        for (long long k = i; k <= j; k++) {
          if (s[k] >= 65 && s[k] <= 90) {
            if (s[k] != C)
              ans[k] = C;
            else
              ans[k] = CH;
          } else {
            if (s[k] != c)
              ans[k] = c;
            else
              ans[k] = ch;
          }
        }
      } else {
        for (long long k = i; k <= j; k++) {
          if (ans[i] == '-') ans[i] = s[k];
        }
      }
    }
  }
  cout << ans << "\n";
  return 0;
}
