#include <bits/stdc++.h>
using namespace std;
const int N = 110;
const int memsize = 20000;
struct Node {
  char val;
  int kill = 0;
  Node *failed = NULL;
  Node *pre = NULL;
  vector<Node *> child;
  Node() {}
  Node(char _val, Node *_pre) : val(_val), pre(_pre) {}
  int find_char(char c) {
    int i = 0;
    for (auto it = child.begin(); it != child.end(); it++) {
      if ((*it)->val == c) break;
      i++;
    }
    return i;
  }
};
Node mem[memsize];
Node *root = mem;
Node *pmem = mem;
void str_insert(char *s) {
  int lenS = strlen(s);
  Node *cur = root;
  for (int i = 0; i < lenS; i++) {
    char c = s[i];
    if (cur->find_char(c) == cur->child.size()) {
      Node *a = new (++pmem) Node(s[i], cur);
      if (i == lenS - 1) a->kill = lenS;
      (cur->child).push_back(a);
      cur = a;
    } else {
      cur = cur->child[cur->find_char(c)];
      if (i == lenS - 1) cur->kill = lenS;
    }
  }
}
void build_fail() {
  queue<Node *> que;
  que.push(root);
  root->failed = root;
  while (!que.empty()) {
    Node *cur = que.front();
    que.pop();
    for (auto it = cur->child.begin(); it != cur->child.end(); it++) {
      Node *ptr = cur->failed;
      char c = (*it)->val;
      while (ptr != root && ptr->find_char(c) == ptr->child.size()) {
        ptr = ptr->failed;
      }
      (*it)->failed = ptr;
      if (ptr->find_char(c) != ptr->child.size()) {
        (*it)->failed = ptr->child[ptr->find_char(c)];
      }
      if (cur == root) (*it)->failed = root;
      if (cur->kill == 0) cur->kill = cur->failed->kill;
      que.push(*it);
    }
  }
}
int change[N];
int cap[N];
void match(char *name) {
  int lenN = strlen(name);
  Node *cur = root;
  for (int i = 0; i < lenN; i++) {
    char c = name[i];
    while (cur != root && cur->find_char(c) == cur->child.size()) {
      cur = cur->failed;
    }
    if (cur->find_char(c) != cur->child.size()) {
      cur = cur->child[cur->find_char(c)];
    }
    change[i] = cur->kill;
  }
}
int main() {
  int n;
  scanf("%d", &n);
  char s[N];
  while (n--) {
    scanf("%s", s);
    for (int i = 0; i < strlen(s); i++) {
      s[i] = tolower(s[i]);
    }
    str_insert(s);
  }
  build_fail();
  char name[N];
  scanf("%s", name);
  memset(change, 0, sizeof(change));
  memset(cap, 0, sizeof(change));
  for (int i = 0; i < strlen(name); i++) {
    if (name[i] == toupper(name[i])) cap[i] = 1;
    name[i] = tolower(name[i]);
  }
  char letter;
  scanf(" %c", &letter);
  match(name);
  int rc[N];
  memset(rc, 0, sizeof(rc));
  for (int i = 0; i < strlen(name); i++) {
    int num = change[i];
    while (num--) {
      rc[i - num] = 1;
    }
  }
  for (int i = 0; i < strlen(name); i++) {
    if (rc[i] == 1) {
      if (name[i] == letter) {
        name[i] = (letter == 'a') ? 'b' : 'a';
      } else {
        name[i] = letter;
      }
    }
  }
  for (int i = 0; i < strlen(name); i++) {
    if (cap[i] == 1) {
      printf("%c", toupper(name[i]));
    } else {
      printf("%c", tolower(name[i]));
    }
  }
}
