// // Gaurav Aggarwal
 
// /*
// useful stl
// array<ll,size> ar;         //size(),front(),back(),fill(),empty()
// deque<ll> d                //push_back(),push_front(),pop_front(),pop_back()
// vector<ll> v(size,val);    //push_back(),*max_element(v.begin(),v.end()),accumulate(v.begin(),v.end(),0)
// stack<ll> g;               //push(),pop(),top(),size(),empty()         LIFO
// queue<ll> q;               //push(),size(),front(),back(),empty()      FIFO
// priority_queue<ll> pq
// */
 
// #include<bits/stdc++.h>
// using namespace std;
 
// typedef long long ll;
// typedef pair<ll,ll> ipair;
// typedef pair<long,long> lpair;
// typedef pair<double,double> pdd;
// #define For(i, a, b) for(__typeof (a) i=a; i<=b; i++)
// #define mod 1000000007
// #define PI 3.141592653589793238462643383279502884 
// #define debug1(a) cout<<a<<"\n";
// #define debug2(a,b) cout<<a<<" "<<b<<"\n";
// #define debug3(a,b,c) cout<<a<<" "<<b<<" "<<c<<"\n";
// #define debug_arr(a,n) {for(__typeof (n) i=0; i<n; ++i) {cout<<a[i]<<" ";}}
// #define inp_arr(a,n) for(__typeof (n) i=0; i<n; ++i) {cin>>a[i];}
// #define beg_arr(a,n) for(__typeof (n) i=0; i<n; ++i) {a[i] = 0;}
 
// ll power(ll x, ll y) 
// { 
//     ll res = 1;   
//     while (y > 0) { 
//         if (y & 1) 
//             res = (res*x)%mod; 
//         y = y>>1;
//         x = (x*x)%mod; 
//     } 
//     return res%mod; 
// }

// // void dfs(int s, int a) {
// //     a[s] = 1;
// //     for(int b: graph[s]) {
// //         if(!a[s])
// //             dfs(b,a);
// //     }
// // }

// int main() {
//     ios_base::sync_with_stdio(false);
//     cin.tie(0);
//     cout.tie(0);
 
//     #ifndef ONLINE_JUDGE
//     freopen("input.txt", "r", stdin);
//     freopen("out.txt", "w", stdout); 
//     #endif  
 
//     int n,a,b,c,d;
//     cin>>n>>a>>b>>c>>d;
//     string s;
//     cin>>s;

    
//     --a;
//     --b;
//     --c;
//     --d;
//     if(c == d) {
//         cout<<"NO\n";
//         return 0;
//     }

//     if(c > d) {

//         int flag = 0;
//         for(int i=a;i<=d;++i) {
//             if(i+2 < n) {
//                 if(s[i] == '.' and s[i+1] == '.' and s[i+2] == '.') {
//                     flag = 1;
//                     break;
//                 }
//             }
//         }
//         if(!flag) {
//             cout<<"NO\n";
//             break;
//         }

//     }
   
//     return 0;
// }

    // Gaurav Aggarwal
     
    /*
    useful stl
    array<ll,size> ar;         //size(),front(),back(),fill(),empty()
    deque<ll> d                //push_back(),push_front(),pop_front(),pop_back()
    vector<ll> v(size,val);    //push_back(),*max_element(v.begin(),v.end()),accumulate(v.begin(),v.end(),0)
    stack<ll> g;               //push(),pop(),top(),size(),empty()         LIFO
    queue<ll> q;               //push(),size(),front(),back(),empty()      FIFO
    priority_queue<ll> pq
    */
     
    #include<bits/stdc++.h>
    using namespace std;
     
    typedef long long ll;
    typedef pair<ll,ll> ipair;
    typedef pair<long,long> lpair;
    typedef pair<double,double> pdd;
    #define For(i, a, b) for(__typeof (a) i=a; i<=b; i++)
    #define mod 1000000007
    #define PI 3.141592653589793238462643383279502884 
    #define debug1(a) cout<<a<<"\n";
    #define debug2(a,b) cout<<a<<" "<<b<<"\n";
    #define debug3(a,b,c) cout<<a<<" "<<b<<" "<<c<<"\n";
    #define debug_arr(a,n) {for(__typeof (n) i=0; i<n; ++i) {cout<<a[i]<<" ";}}
    #define inp_arr(a,n) for(__typeof (n) i=0; i<n; ++i) {cin>>a[i];}
    #define beg_arr(a,n) for(__typeof (n) i=0; i<n; ++i) {a[i] = 0;}
     
    ll power(ll x, ll y) 
    { 
        ll res = 1;   
        while (y > 0) { 
            if (y & 1) 
                res = (res*x)%mod; 
            y = y>>1;
            x = (x*x)%mod; 
        } 
        return res%mod; 
    }
     
    // void dfs(int s, int a) {
    //     a[s] = 1;
    //     for(int b: graph[s]) {
    //         if(!a[s])
    //             dfs(b,a);
    //     }
    // }
     
    int main() {
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
     
        // #ifndef ONLINE_JUDGE
        // freopen("input.txt", "r", stdin);
        // freopen("out.txt", "w", stdout); 
        // #endif  
     
        int n,a,b,c,d;
        cin>>n>>a>>b>>c>>d;
        string s;
        cin>>s;
     
        
            
        int one = 0, two = 0;
        int pos1 = a-1, pos2 = b-1;
        int chance = 0;
        int turn = 0;
        if(d > c)
            chance = 1;
     
        while(one == 0 or two == 0) {
     
            // cout<<pos1<<" "<<pos2<<" "<<chance<<"\n";
            
            if(turn >= 2) {
                cout<<"No\n";
                return 0;
            }
     
            if(chance == 0) {
     
                if(one == 1) {
                    cout<<"No\n";
                    return 0;
                }
     
                if(pos1 + 1 < n and s[pos1+1] == '.' and pos1 + 1 != pos2) {
                    pos1 += 1;
                    if(pos1 == c - 1) {
                        one = 1;
                        chance = 1;
                    }
                    turn = 0;
                }
     
                else if(pos1 + 2 < n and s[pos1+2] == '.' and pos1 + 2 != pos2) {
                    pos1 += 2;
                    if(pos1 == c - 1) {
                        one = 1;
                        chance = 1;
                    }
                    turn = 0;
                }
     
                else if(pos1 + 1 < n and pos1+1 == pos2) {
                    chance = 1;
                    turn++;
                }
     
                else if(pos1 + 1 < n and pos1+2 == pos2) {
                    chance = 1;
                    turn++;
                }
     
                else {
                    cout<<"No\n";
                    return 0;
                }
     
                if(d > c and two == 0) {
                    chance = 1;
                }
     
            }
            else {
                if(two == 1) {
                    cout<<"No\n";
                    return 0;
                }
     
                if(pos2 + 1 < n and s[pos2+1] == '.' and pos2 + 1 != pos1) {
                    pos2 += 1;
                    if(pos2 == d - 1) {
                        two = 1;
                        chance = 0;
                    }
                    turn = 0;
                }
     
                else if(pos2 + 2 < n and s[pos2+2] == '.' and pos2 + 2 != pos1) {
                    pos2 += 2;
                    if(pos2 == d - 1) {
                        two = 1;
                        chance = 0;
                    }
                    turn = 0;
                }
     
                else if(pos2 + 1 < n and pos2+1 == pos1) {
                    chance = 0;
                    turn++;
                }
     
                else if(pos2 + 1 < n and pos2+2 == pos1) {
                    chance = 0;
                    turn++;
                }
     
                else {
                    cout<<"No\n";
                    return 0;
                }
     
                if(c > d and one == 0) {
                    chance = 0;
                }
            }
     
     
        }
     
        cout<<"Yes\n";
       
        return 0;
    }

Measured memory_bytes: 592