#include <bits/stdc++.h>
using namespace std;
char s[101][101];
char t[101];
int f[101];
int n;
bool ss(int i, int j, int l, int m) {
  if (j + l <= m) {
    int k;
    for (k = j; k < l + j; k++)
      if (s[i][k - j] != s[n][k]) return 0;
    return 1;
  }
  return 0;
}
char Fi(char c) {
  for (char i = 'A';; i++)
    if (i != c) return i;
}
char fi(char c) {
  for (char i = 'a';; i++)
    if (i != c) return i;
}
int main() {
  int i, j, m, k;
  char c;
  cin >> n;
  for (i = 0; i < n; i++) cin >> s[i];
  cin >> s[n];
  cin >> c;
  m = strlen(s[n]);
  for (j = 0; j < m; j++) {
    t[j] = s[n][j];
  }
  t[m] = 0;
  for (i = 0; i <= n; i++) {
    m = strlen(s[i]);
    for (j = 0; j < m; j++) {
      if (s[i][j] <= 'Z') s[i][j] = 'a' + s[i][j] - 'A';
    }
  }
  m = strlen(s[n]);
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      int l = strlen(s[i]);
      if (ss(i, j, l, m)) {
        for (k = j; k < l + j; k++) f[k] = 1;
      }
    }
  }
  for (j = 0; j < m; j++)
    if (f[j]) {
      if (t[j] <= 'Z') {
        if (t[j] == ('A' + c - 'a'))
          t[j] = Fi('A' + c - 'a');
        else
          t[j] = 'A' + c - 'a';
      } else {
        if (t[j] == c)
          t[j] = fi(c);
        else
          t[j] = c;
      }
    }
  for (j = 0; j < m; j++) cout << t[j];
  return 0;
}
