#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
inline long long getint() {
  long long _x = 0, _tmp = 1;
  char _tc = getchar();
  while ((_tc < '0' || _tc > '9') && _tc != '-') _tc = getchar();
  if (_tc == '-') _tc = getchar(), _tmp = -1;
  while (_tc >= '0' && _tc <= '9') _x *= 10, _x += (_tc - '0'), _tc = getchar();
  return _x * _tmp;
}
inline long long add(long long _x, long long _y,
                     long long _mod = 1000000007LL) {
  _x += _y;
  return _x >= _mod ? _x - _mod : _x;
}
inline long long sub(long long _x, long long _y,
                     long long _mod = 1000000007LL) {
  _x -= _y;
  return _x < 0 ? _x + _mod : _x;
}
inline long long mul(long long _x, long long _y,
                     long long _mod = 1000000007LL) {
  _x *= _y;
  return _x >= _mod ? _x % _mod : _x;
}
long long mypow(long long _a, long long _x, long long _mod) {
  if (_x == 0) return 1LL;
  long long _ret = mypow(mul(_a, _a, _mod), _x >> 1, _mod);
  if (_x & 1) _ret = mul(_ret, _a, _mod);
  return _ret;
}
long long mymul(long long _a, long long _x, long long _mod) {
  if (_x == 0) return 0LL;
  long long _ret = mymul(add(_a, _a, _mod), _x >> 1, _mod);
  if (_x & 1) _ret = add(_ret, _a, _mod);
  return _ret;
}
inline bool equal(double _x, double _y) {
  return _x > _y - 1e-9 && _x < _y + 1e-9;
}
int __ = 1, _cs;
void build() {}
int n;
string f[111], w, l;
char lower(char ctmp) {
  if (ctmp >= 'a') return ctmp;
  return ctmp - 'A' + 'a';
}
char letter;
void init() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> f[i];
  cin >> w;
  cin >> l;
  letter = lower(l[0]);
}
bool equal(const string& a, const string& b) {
  if (a.length() != b.length()) return false;
  int len = a.length();
  for (int i = 0; i < len; i++)
    if (lower(a[i]) != lower(b[i])) return false;
  return true;
}
bool rr[111];
char chg(char ori) {
  if (ori >= 'a') {
    if (ori == letter) {
      char ret = 'a';
      if (ret == ori) ret++;
      return ret;
    }
    return letter;
  }
  char tmp = letter - 'a' + 'A';
  if (ori == tmp) {
    char ret = 'A';
    if (ret == ori) ret++;
    return ret;
  }
  return tmp;
}
void solve() {
  for (int i = 0; i < n; i++) {
    if (f[i].length() > w.length()) continue;
    int lf = f[i].length();
    int lw = w.length();
    for (int j = 0; j <= lw - lf; j++) {
      if (equal(f[i], w.substr(j, lf))) {
        for (int k = j; k < j + lf; k++) rr[k] = true;
      }
    }
  }
  string ans = "";
  for (size_t i = 0; i < w.length(); i++)
    if (rr[i])
      ans += chg(w[i]);
    else
      ans += w[i];
  cout << ans << endl;
}
int main() {
  build();
  while (__--) {
    init();
    solve();
  }
}
