#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
long long max(long long a, long long b) {
  if (a > b)
    return a;
  else
    return b;
}
long long min(long long a, long long b) {
  if (a < b)
    return a;
  else
    return b;
}
long long gcd(long long a, long long b, long long& x, long long& y) {
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  }
  long long x1, y1;
  long long d = gcd(b, a % b, x1, y1);
  x = y1;
  y = x1 - y1 * (a / b);
  return d;
}
long long inv(long long a) {
  long long x, y;
  long long g = gcd(a, mod, x, y);
  x = (x % mod + mod) % mod;
  return x;
}
long long binpow(long long a, long long b, long long m) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return res;
}
int case_insensitive_match(string s1, string s2) {
  transform(s1.begin(), s1.end(), s1.begin(), ::tolower);
  transform(s2.begin(), s2.end(), s2.begin(), ::tolower);
  if (s1.compare(s2) == 0) return 1;
  return 0;
}
int main() {
  int t;
  t = 1;
  while (t--) {
    int n;
    cin >> n;
    vector<string> v;
    for (int i = 0; i < n; i++) {
      string h;
      cin >> h;
      v.push_back(h);
    }
    string w;
    cin >> w;
    char c;
    cin >> c;
    string x = w;
    for (int i = 0; i < n; i++) {
      string g = v[i];
      if (g.length() > w.length()) continue;
      for (int j = 0; j <= w.length() - g.length(); j++) {
        string u = w.substr(j, g.length());
        if (case_insensitive_match(u, g)) {
          for (int k = j; k < j + u.length(); k++) {
            if (toupper(w[k]) == toupper(c)) {
              if (toupper(w[k]) != 'A') {
                if (isupper(w[k]))
                  x[k] = 'A';
                else
                  x[k] = 'a';
              } else {
                if (isupper(w[k]))
                  x[k] = 'B';
                else
                  x[k] = 'b';
              }
            } else {
              if (isupper(w[k]))
                x[k] = toupper(c);
              else
                x[k] = tolower(c);
            }
          }
        }
      }
    }
    cout << x;
  }
  return 0;
}
