#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  getline(cin, s);
  vector<string> words;
  for (int i = 0; i < n; ++i) {
    getline(cin, s);
    string s1 = "";
    for (int j = 0; j < s.length(); ++j) {
      if (s[j] >= 'a' && s[j] <= 'z') {
        s1 += s[j];
      } else {
        s1 += char(s[j] - 'A' + 'a');
      }
    }
    words.push_back(s1);
  }
  getline(cin, s);
  string s1 = "";
  for (int i = 0; i < s.length(); ++i) {
    if (s[i] >= 'a' && s[i] <= 'z')
      s1 += s[i];
    else
      s1 += char(s[i] - 'A' + 'a');
  }
  string letter;
  getline(cin, letter);
  bool a[300];
  for (int i = 0; i < s.length(); ++i) {
    a[i] = false;
  }
  for (int i = 0; i < s.length(); ++i) {
    for (int j = 0; j < n; ++j) {
      int f = 1;
      for (int q = 0; q < words[j].length(); ++q) {
        if (i + q >= s.length()) {
          f = 0;
        } else {
          if (s1[i + q] != words[j][q]) f = 0;
        }
      }
      if (f == 1) {
        for (int q = 0; q < words[j].length(); ++q) {
          a[i + q] = true;
        }
      }
    }
  }
  string ans = "";
  for (int i = 0; i < s.length(); ++i) {
    if (a[i]) {
      if (s1[i] == letter[0]) {
        if (s[i] >= 'a' && s[i] <= 'z')
          if (letter[0] != 'a')
            ans += 'a';
          else
            ans += 'b';
        else if (letter[0] != 'a')
          ans += 'A';
        else
          ans += 'B';
      } else {
        if (s[i] >= 'A' && s[i] <= 'Z')
          ans += char(letter[0] - 'a' + 'A');
        else
          ans += letter[0];
      }
    } else {
      ans += s[i];
    }
  }
  cout << ans;
  return 0;
}
