#include <bits/stdc++.h>
using namespace std;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int n, a, b, c, d;
    cin >> n >> a >> b >> c >> d;
    string s;
    cin >> s;
    a--; b--; c--; d--;
    
    if((b < c) && (a < d) && (c < d)){
        vector<bool> dp(n);
        dp[b] = true;
        for(int i = b; i < n; i++){
            if(s[i] == '#') continue;
            if(i + 1 >= n) continue;
            if(dp[i] and s[i + 1] == '.'){
                dp[i + 1] = true;
            }
            if(i + 2 >= n) continue;
            if(dp[i] and s[i + 2] == '.'){
                dp[i + 2] = true;
            }
        }
        if(dp[d]);
        else{
            cout << "No" << endl;
            return 0;
        }

        fill(dp.begin(), dp.end(), false);
        dp[a] = true;
        for(int i = a; i < n; i++){
            if(s[i] == '#') continue;
            if(i + 1 >= n) continue;
            if(dp[i] and s[i + 1] == '.'){
                dp[i + 1] = true;
            }
            if(i + 2 >= n) continue;
            if(dp[i] and s[i + 2] == '.'){
                dp[i + 2] = true;
            }
        }
        if(dp[c]){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
        return 0;
    }else if((a < c) && (b < d) && (c < b)){
        vector<bool> dp(n);
        dp[a] = true;
        for(int i = a; i < n; i++){
            if(s[i] == '#') continue;
            if(i + 1 >= n) continue;
            if(dp[i] and s[i + 1] == '.'){
                dp[i + 1] = true;
            }
            if(i + 2 >= n) continue;
            if(dp[i] and s[i + 2] == '.'){
                dp[i + 2] = true;
            }
        }
        if(dp[c]);
        else{
            cout << "No" << endl;
            return 0;
        }
        fill(dp.begin(), dp.end(), false);
        dp[b] = true;
        for(int i = b; i < n; i++){
            if(s[i] == '#') continue;
            if(i + 1 >= n) continue;
            if(dp[i] and s[i + 1] == '.'){
                dp[i + 1] = true;
            }
            if(i + 2 >= n) continue;
            if(dp[i] and s[i + 2] == '.'){
                dp[i + 2] = true;
            }
        }
        if(dp[d]){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
        return 0;
    }else{
        bool f = false;
        for(int i = b; i <= d; i++){
            if(i - 1 < 0 or i + 1 >= n) continue;
            if(s[i - 1] == '.' && s[i] == '.' && s[i + 1] == '.'){
                f = true;
                break;
            }
        }
        if(!f){
            cout << "No" << endl;
            return 0;
        }
        vector<bool> dp(n);
        dp[a] = true;
        for(int i = a; i < n; i++){
            if(s[i] == '#') continue;
            if(i + 1 >= n) continue;
            if(dp[i] and s[i + 1] == '.'){
                dp[i + 1] = true;
            }
            if(i + 2 >= n) continue;
            if(dp[i] and s[i + 2] == '.'){
                dp[i + 2] = true;
            }
        }
        if(dp[c]);
        else{
            cout << "No" << endl;
            return 0;
        }
        fill(dp.begin(), dp.end(), false);
        dp[b] = true;
        for(int i = b; i < n; i++){
            if(s[i] == '#') continue;
            if(i + 1 >= n) continue;
            if(dp[i] and s[i + 1] == '.'){
                dp[i + 1] = true;
            }
            if(i + 2 >= n) continue;
            if(dp[i] and s[i + 2] == '.'){
                dp[i + 2] = true;
            }
        }
        if(dp[d]){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
        return 0;
    }

    return 0;
}

Measured memory_bytes: 592