#include <bits/stdc++.h>
using namespace std;
const int maxn = 110;
string s[maxn], down[maxn], wdown;
int main() {
  int n;
  cin >> n;
  char low_bound = min('a', 'A'), up_bound = max('a', 'A');
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    for (int j = 0; j < s[i].size(); j++) {
      down[i] += (s[i][j] >= up_bound ? up_bound : low_bound);
      s[i][j] -= down[i][j];
    }
  }
  string w;
  cin >> w;
  for (int i = 0; i < w.size(); i++) {
    wdown += (w[i] >= up_bound ? up_bound : low_bound);
    w[i] -= wdown[i];
  }
  char fav;
  cin >> fav;
  char fdown = (fav >= up_bound ? up_bound : low_bound);
  fav -= fdown;
  string t = w;
  for (int i = 0; i < w.size(); i++)
    for (int j = 0; j < n; j++) {
      bool fit = true;
      for (int k = i; k < i + s[j].size(); k++)
        if (k >= w.size() || w[k] != s[j][k - i]) fit = false;
      if (fit)
        for (int k = i; k < i + s[j].size(); k++)
          if (w[k] != fav)
            t[k] = fav;
          else
            t[k] = !fav;
    }
  w = t;
  for (int i = 0; i < w.size(); i++) w[i] += wdown[i];
  cout << w;
  return 0;
}
