#include <iostream>

using namespace std;

int main()
{
    int n;
    char a,b, c, d;
    cin >> n >> a >> b >> c >> d;
    char s[1000] = { '0' };
    cin >> s;
    char* p = s;
    for (int i = 0; i < n; i++)
    {
        if (*p == a)
        {
            *p = b;
        }
        else if (*p == c)
        {
            *p = d;
        }
        p++;
    }
    cout << s << endl;
}