#include <bits/stdc++.h>
using namespace std;
const int maxn = int(1.5 * 1e7);
const int inf = 1e9 + 7;
const long long ll_inf = 1e18 + 420;
const double eps = 1e-4;
const int N = 1e6 + 7;
const int MAX = 2e5 + 9;
const int mod = 1e9 + 7;
const long double pi = 3.14159265359;
int n;
string s[200], w;
char t;
bool b[200];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> s[i];
  }
  cin >> w;
  cin >> t;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < w.size(); j++) {
      string s1 = w.substr(j, s[i].size());
      bool flag = 1;
      if (s1.size() < s[i].size()) {
        flag = 0;
      } else {
        for (int k = 0; k < s1.size(); k++) {
          char x = s1[k], y = s[i][k];
          if (x >= 'A' && x <= 'Z') {
            x += ' ';
          }
          if (y >= 'A' && y <= 'Z') {
            y += ' ';
          }
          if (x != y) {
            flag = 0;
            break;
          }
        }
      }
      if (flag) {
        for (int l = j; l < j + s[i].size(); l++) {
          b[l] = 1;
        }
      }
    }
  }
  for (int i = 0; i < w.size(); i++) {
    if (b[i]) {
      char x = w[i];
      if (x >= 'A' && x <= 'Z') {
        x += ' ';
      }
      if (x == t && t == 'a') {
        if (w[i] >= 'a' && w[i] <= 'z') {
          w[i] = 'b';
        } else {
          w[i] = 'B';
        }
      } else if (x == t && t != 'a') {
        if (w[i] >= 'a' && w[i] <= 'z') {
          w[i] = 'a';
        } else {
          w[i] = 'A';
        }
      } else {
        if (w[i] >= 'a' && w[i] <= 'z') {
          w[i] = t;
        } else {
          w[i] = t - ' ';
        }
      }
    }
  }
  cout << w;
}
