#include <bits/stdc++.h>
using namespace std;
int n, was[101];
string s[101], w;
char letter;
int main() {
  scanf("%d\n", &n);
  memset(was, 0, sizeof was);
  for (int i = 0; i < n; ++i) cin >> s[i];
  cin >> w >> letter;
  if (letter < 97) letter += 32;
  for (int i = 0; i < w.length(); ++i) {
    for (int j = 0; j < n; ++j)
      if (s[j].length() + i <= w.length()) {
        int YES = 0;
        for (int k = 0; k < s[j].length(); ++k) {
          if (s[j][k] == w[i + k]) ++YES;
          if (s[j][k] == (w[i + k] + 32)) ++YES;
          if (s[j][k] == (w[i + k] - 32)) ++YES;
        }
        if (YES == s[j].length()) {
          for (int k = 0; k < s[j].length(); ++k) was[i + k] = 1;
        }
      }
  }
  for (int i = 0; i < w.length(); ++i)
    if (was[i]) {
      if (w[i] != letter && w[i] != (letter - 32)) {
        if (w[i] >= 97)
          w[i] = letter;
        else
          w[i] = (letter - 32);
      } else {
        if (letter != 'a') {
          if (w[i] >= 97)
            w[i] = 'a';
          else
            w[i] = ('A');
        } else {
          if (w[i] >= 97)
            w[i] = 'b';
          else
            w[i] = ('B');
        }
      }
    }
  cout << w;
  return 0;
}
