#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n;
  char ch;
  string s[n + 1];
  for (int i = 0; i <= n; i++) {
    cin >> s[i];
  }
  cin >> ch;
  vector<short> A(s[n].length());
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < s[n].length() && j + s[i].length() - 1 < s[n].length();
         j++) {
      bool ok = true;
      for (int z = 0; z < s[i].length() && j + z < s[n].length(); z++) {
        if (tolower(s[i][z]) != tolower(s[n][j + z])) {
          ok = false;
          break;
        }
      }
      if (ok) {
        for (int z = 0; z < s[i].length(); z++) {
          A[j + z] = 1;
        }
      }
    }
  }
  for (int i = 0; i < s[n].length(); i++) {
    if (A[i] == 0)
      cout << s[n][i];
    else if (s[n][i] >= 'a' && s[n][i] <= 'z') {
      if (s[n][i] != ch)
        cout << ch;
      else if (ch == 'a')
        cout << 'b';
      else
        cout << 'a';
    } else {
      if (s[n][i] != toupper(ch))
        cout << (char)toupper(ch);
      else if (ch == 'a')
        cout << 'B';
      else
        cout << 'A';
    }
  }
  return 0;
}
