#include <bits/stdc++.h>
using namespace std;
bool match(string a, string b, int pos, int ln) {
  int c = 0, j = 0;
  for (int i = pos; i < ln + pos; i++) {
    if (a[i] != b[j])
      return false;
    else
      c++;
    j++;
  }
  if (ln == c)
    return true;
  else
    return false;
}
int main() {
  int n;
  cin >> n;
  string a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  string str;
  char ch;
  cin >> str >> ch;
  string str1 = str;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < a[i].size(); j++) {
      if (a[i][j] < 95) a[i][j] += 32;
    }
  }
  for (int i = 0; i < str.size(); i++) {
    if (str[i] < 95) str[i] += 32;
  }
  set<int> s;
  vector<int> v;
  queue<int> q;
  for (int i = 0; i < str.size(); i++) {
    for (int j = 0; j < n; j++) {
      int ln = a[j].size();
      if (match(str, a[j], i, ln)) {
        for (int k = i; k < i + ln; k++) {
          v.push_back(k);
        }
      }
    }
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < v.size(); i++) {
    s.insert(v[i]);
  }
  set<int>::iterator it;
  for (it = s.begin(); it != s.end(); ++it) {
    q.push(*it);
  }
  for (int i = 0; i < str.size(); i++) {
    if (i == q.front()) {
      if (ch == str[i]) {
        if (str1[i] < 95 && ch != 'a')
          cout << 'A';
        else if (str1[i] < 95 && ch == 'a')
          cout << 'B';
        else if (str1[i] > 95 && ch != 'a')
          cout << 'a';
        else
          cout << 'b';
      } else {
        if (str1[i] < 95)
          cout << (char)(ch - 32);
        else
          cout << ch;
      }
      q.pop();
    } else
      cout << str1[i];
  }
  cout << endl;
  return 0;
}
