#include <bits/stdc++.h>
using namespace std;
vector<string> P;
string T;
bool match(int p, int pos) {
  for (int i = 0; i < P[p].size(); ++i) {
    if (pos + i > T.size()) return false;
    if (tolower(T[pos + i]) != tolower(P[p][i])) return false;
  }
  return true;
}
string R;
char matchCase(char a, char b) {
  if (b == tolower(b)) return tolower(a);
  return toupper(a);
}
void replace(int p, int pos, char c) {
  c = tolower(c);
  for (int i = 0; i < P[p].size(); ++i) {
    char e = c;
    if (tolower(T[pos + i]) == c) {
      e = (e == 'a' ? 'b' : 'a');
    }
    R[pos + i] = matchCase(e, T[pos + i]);
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    P.push_back(s);
  }
  cin >> T;
  char letter;
  cin >> letter;
  R = T;
  for (int i = 0; i < P.size(); ++i) {
    for (int j = 0; j < T.size(); ++j)
      if (match(i, j)) replace(i, j, letter);
  }
  cout << R << endl;
  return 0;
}
