#include <bits/stdc++.h>
using namespace std;
char little(char q) {
  if (q >= 'a' && q <= 'z')
    return q;
  else
    return (q + 'a' - 'A');
}
string lt(string s) {
  for (int i = 0; i < s.size(); ++i) s[i] = little(s[i]);
  return s;
}
int main() {
  int k, i, j, n;
  string have, s1, here, s[200], sl[200];
  char q, bq;
  scanf("%d\n", &n);
  for (i = 1; i <= n; ++i) getline(cin, s[i]);
  for (i = 1; i <= n; ++i) sl[i] = lt(s[i]);
  getline(cin, have);
  cin >> q;
  if (q >= 'A' && q <= 'Z') q = q - 'A' + 'a';
  here = have;
  bq = q - 'a' + 'A';
  for (i = 1; i <= n; ++i) {
    if (have.size() >= s[i].size())
      for (j = 0; j < have.size() - s[i].size() + 1; ++j) {
        s1 = "";
        for (k = j; k < j + s[i].size(); ++k) s1 = s1 + little(have[k]);
        if (s1 == sl[i]) {
          for (k = j; k < j + s[i].size(); ++k)
            if (have[k] == bq) {
              if (bq == 'A')
                here[k] = 'B';
              else
                here[k] = 'A';
            } else if (have[k] == q) {
              if (q == 'a')
                here[k] = 'b';
              else
                here[k] = 'a';
            } else if (have[k] >= 'A' && have[k] <= 'Z')
              here[k] = bq;
            else
              here[k] = q;
        }
      }
  }
  cout << here << endl;
}
