#include <bits/stdc++.h>
using namespace std;
double eps = 1e-9;
const int INF = 1e9 + 7;
const int MAXN = int(3e5 + 7);
int n;
string second[107], t, r, ans;
char c;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> second[i];
  cin >> t >> c;
  r = t;
  for (int i = 0; i < t.size(); i++) {
    int m = -1;
    for (int j = 0; j < n; j++) {
      bool ok = 1;
      if (i + second[j].size() <= t.size())
        for (int k = 0; k < second[j].size(); k++) {
          char r1 = tolower(second[j][k]);
          char r2 = tolower(t[i + k]);
          if (r1 != r2) ok = 0;
        }
      else
        ok = 0;
      if (ok) m = max(m, (int)second[j].size());
    }
    for (int j = i; j < i + m; j++) {
      bool upper = 0;
      if (t[j] >= 'A' && t[j] <= 'Z') upper = 1;
      r[j] = tolower(t[j]);
      if (r[j] == c) {
        if (c == 'a')
          r[j] = 'b';
        else
          r[j] = 'a';
      } else
        r[j] = c;
      if (upper) r[j] -= 'a' - 'A';
    }
  }
  cout << r;
  return 0;
}
