int main() {
    int n;
    char a1, a2, a3, a4;
    scanf("%d %c %c %c %c\n", &n, &a1, &a2, &a3, &a4);
    char s[n];
    for (int i = 0; i < n; i++) {
        scanf("%c", &s[i]);
    }
    for (int i = 0; i < n; i++) {
        if (s[i] == a1) s[i] = a2;
        if (s[i] == a3) s[i] = a4;
        printf("%c", s[i]);
    }
    return 0;
}