Problem:
Score : 400 points

Problem Statement

There are N squares arranged in a row, numbered 1, 2, ..., N from left to right.
You are given a string S of length N consisting of . and #. If the i-th character of S is #, Square i contains a rock; if the i-th character of S is ., Square i is empty.

In the beginning, Snuke stands on Square A, and Fnuke stands on Square B.

You can repeat the following operation any number of times:

Choose Snuke or Fnuke, and make him jump one or two squares to the right. The destination must be one of the squares, and it must not contain a rock or the other person.

You want to repeat this operation so that Snuke will stand on Square C and Fnuke will stand on Square D.

Determine whether this is possible.

Constraints

4 \leq N \leq 200\ 000

S is a string of length N consisting of . and #.

1 \leq A, B, C, D \leq N

Square A, B, C and D do not contain a rock.

A, B, C and D are all different.

A < B

A < C

B < D

Input

Input is given from Standard Input in the following format:

N A B C D
S

Output

Print Yes if the objective is achievable, and No if it is not.

Sample Input 1

7 1 3 6 7
.#..#..

Sample Output 1

Yes

The objective is achievable by, for example, moving the two persons as follows. (A and B represent Snuke and Fnuke, respectively.)

A#B.#..

A#.B#..

.#AB#..

.#A.#B.

.#.A#B.

.#.A#.B

.#..#AB

Sample Input 2

7 1 3 7 6
.#..#..

Sample Output 2

No

Sample Input 3

15 1 3 15 13
...#.#...#.#...

Sample Output 3

Yes

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////


int main(){
    
    int n,a,b,c,d;
    cin >> n >> a >> b >> c >> d;
    string s;
    cin >> s;

    a--;b--;c--;d--;

    s[a] = 'a';s[b] = 'b';
    int t = 0,an = 0,bn = 0;

    int cnt = 0;
    while(a != c || b != d){
	cnt++;
	if(cnt > 1000000){
	    No;
	    ret 0;
	}
	//	P(s);
	int nn = 0;
	if(t == 0){
	    if(a == c){
		if(bn == 1){
		    if( a > b){
			if(a+1 < n && s[a+1] == '.'){
			    s[a] = '.';
			    a += 1;
			    s[a] = 'a';
			    an = 0;
			}if(a+2 < n && s[a+2] == '.'){
			    s[a] = '.';
			    a += 2;
			    s[a] = 'a';
			    an = 0;
			}else an = 1;
		    }else{
			if(0 <= a-1 && s[a-1] == '.'){
			    s[a] = '.';
			    a -= 1;
			    s[a] = 'a';
			    an = 0;
			}else if(0 <= a-2 && s[a-2] == '.'){
			    s[a] = '.';
			    a -= 2;
			    s[a] = 'a';
			    an = 0;
			}else an = 1;
		    }
		}
		t = 1;
	    }else if(a < c){
		if(a+1 < n &&s[a+1] == '.'){
		    s[a] = '.';
		    a += 1;
		    s[a] = 'a';
		    an = 0;
		}else if(a+2 < n &&s[a+2] == '.'){
		    s[a] = '.';
		    a += 2;
		    s[a] = 'a';
		    an = 0;
		}else nn = 1;
	    }else{
		if(a == c){
		    t = 1;
		}else if(0 <= a-1 && s[a-1] == '.'){
		    s[a] = '.';
		    a -= 1;
		    s[a] = 'a';
		    an = 0;
		}else if(0 <= a-2 && s[a-2] == '.'){
		    s[a] = '.';
		    a -= 2;
		    s[a] = 'a';
		    an = 0;
		
		}else nn = 1;
	    }
	    
	    if(nn == 1){
		t = 1;
		an = 1;
		if(an == 1 && bn == 1){
		    if(b == d){
			
		    }else{
			No;
			ret 0;
		    }
		}
	    }else if(a == c)t = 1;
	    
	}else{// t == 1
	    int nn = 0;
	    if(b == d){
		if(an == 1){
		    if( a < b){
			if( b+1 < n && s[b+1] == '.'){
			    s[b] = '.';
			    b += 1;
			    s[b] = 'b';
			    bn = 0;
			}if(b+2 < n && s[b+2] == '.'){
			    s[b] = '.';
			    b += 2;
			    s[b] = 'b';
			    bn = 0;
			}else bn = 1;
		    }else{
			if( 0 <= b-1 && s[b-1] == '.'){
			    s[b] = '.';
			    b -= 1;
			    s[b] = 'b';
			    bn = 0;
			}else if(0 <= b-2 && s[b-2] == '.'){
			    s[b] = '.';
			    b -= 2;
			    s[b] = 'b';
			    bn = 0;
			}else bn = 1;
		    }
		}
		t = 0;
	    }else if(b < d){
		if(b+1 < n &&  s[b+1] == '.'){
		    s[b] = '.';
		    b += 1;
		    s[b] = 'b';
		    bn = 0;
		}else if(b+2 < n &&  s[b+2] == '.'){
		    s[b] = '.';
		    b += 2;
		    s[b] = 'b';
		    bn = 0;
		} else nn = 1;
	
	    }else{
	
		if( 0 <= b-1 && s[b-1] == '.'){
		    s[b] = '.';
		    b -= 1;
		    s[b] = 'b';
		    bn = 0;
		}else if(0 <= b-2 && s[b-2] == '.'){
		    s[b] = '.';
		    b -= 2;
		    s[b] = 'b';
		    bn = 0;
		}else nn = 1;
	    }
	    if(nn == 1){
		t = 0;
		bn = 1;
		if(an == 1 && bn == 1){
		     if(a == c){
			
		    }else{
			 No;
			 ret 0;
		     }
		}
	    }else if(b == d)t = 0;
	}
    }

    //  P(s);
    Yes;
    return  0;
}