#include <bits/stdc++.h>
using namespace std;
int n;
vector<string> dict;
vector<bool> u;
string start, ans;
char letter = '#';
void z_fun(string &s1, string &s2) {
  vector<int> z;
  string s = s1 + '#' + s2;
  int len = s.length();
  z.resize(len);
  z[0] = 0;
  int l = 0, r = 0;
  for (int i = 1; i < len; i++)
    if (i > r) {
      int j;
      for (j = 0; i + j < len && toupper(s[i + j]) == toupper(s[j]); j++)
        ;
      z[i] = j;
      if (z[i] == s1.length()) {
        for (int k = i; k < s1.length() + i; k++) {
          u[k - s1.length() - 1] = true;
        }
      }
      l = i;
      r = i + j - 1;
    } else if (z[i - l] < r - i + 1) {
      z[i] = z[i - l];
      if (z[i] == s1.length()) {
        for (int k = i; k < s1.length() + i; k++) {
          u[k - s1.length() - 1] = true;
        }
      }
    } else {
      int j;
      for (j = 1; r + j < len && toupper(s[r + j]) == toupper(s[r - i + j]);
           j++)
        ;
      z[i] = r - i + j;
      if (z[i] == s1.length()) {
        for (int k = i; k < s1.length() + i; k++) {
          u[k - s1.length() - 1] = true;
        }
      }
      l = i;
      r = r + j - 1;
    }
}
char toSameReg(char ex, char l) {
  if (ex >= 'A' && ex <= 'Z') {
    return toupper(l);
  } else {
    return tolower(l);
  }
}
int main() {
  cin >> n;
  dict.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> dict[i];
  }
  cin >> start;
  cin >> letter;
  u.assign(start.length(), false);
  ans = start;
  for (int i = 0; i < n; i++) {
    z_fun(dict[i], start);
  }
  for (int i = 0; i < u.size(); i++) {
    if (u[i]) {
      if (toupper(start[i]) != toupper(letter)) {
        ans[i] = toSameReg(ans[i], letter);
        continue;
      }
      if (toupper(letter) == 'A') {
        ans[i] = toSameReg(ans[i], 'B');
      } else {
        ans[i] = toSameReg(ans[i], 'A');
      }
    }
  }
  cout << ans;
  return 0;
}
