#include <bits/stdc++.h>
using namespace std;
template <typename T>
int size(T& a) {
  return (int)a.size();
}
template <typename T>
T sqr(T a) {
  return a * a;
}
int n;
char s[200][200];
char str[200];
char lucky;
int len[200];
char ans[200];
char toLower(char ch) {
  if (ch >= 'a' && ch <= 'z') return ch;
  return char('a' + ch - 'A');
}
bool cmp(int pos, int j) {
  for (int i = (pos); i < (pos + len[j]); ++i) {
    if (toLower(str[i]) != toLower(s[j][i - pos])) return false;
  }
  return true;
}
int main() {
  scanf("%d\n", &n);
  for (int i = (0); i < (n); ++i) gets(s[i]), len[i] = strlen(s[i]);
  gets(str);
  scanf("%c", &lucky);
  int str_len = strlen(str);
  for (int i = (0); i < (str_len); ++i) {
    bool ok = false;
    for (int j = (0); j < (n); ++j) {
      if (len[j] > str_len) continue;
      for (int k = (max(0, i - len[j] + 1)); k < (min(i, str_len - len[j]) + 1);
           ++k) {
        if (cmp(k, j)) {
          ok = true;
          break;
        }
      }
      if (ok) break;
    }
    if (ok) {
      if (str[i] == lucky || str[i] == char('A' + lucky - 'a')) {
        if (str[i] == lucky)
          ans[i] = (lucky == 'a') ? 'b' : 'a';
        else
          ans[i] = (lucky == 'a') ? 'B' : 'A';
      } else {
        ans[i] =
            (str[i] >= 'a' && str[i] <= 'z') ? lucky : char('A' + lucky - 'a');
      }
    } else {
      ans[i] = str[i];
    }
  }
  ans[str_len] = 0;
  puts(ans);
}
