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 (Python):
import copy
def main():
    n, a, b, c, d = map(int, input().split())
    step = list(input())

    sn = a - 1
    fn = b - 1

    sn_goal = False
    fn_goal = False
    jump = -1
    
    while True:
        if d < c:
                if (step[fn - 1] == ".") and (step[fn + 1] == "."):
                    jump = copy.deepcopy(fn)
                    
        if fn == d - 1:
            fn_goal = True
            break

        if step[fn + 1] == ".":
            fn += 1
        elif step[fn + 2] == ".":
            fn += 2
        else:
            break

       

    if d < c:
        if jump == -1:
            print("No")
            exit()

        step[jump] = "

    while True:
        if sn == c - 1:
            sn_goal = True
            break

        if step[sn + 1] == ".":
            sn += 1
        elif step[sn + 2] == ".":
            sn += 2
        else:
            break
    
    if sn_goal and fn_goal:
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()

Solution (Python):

n, a, b, c, d = map(int, input().split())
s = input()
if c < d:
    print("YNeos"[any(s[i:i + 2] == "
else:
    if any(s[i:i + 3] == "..." for i in range(b - 2, d - 1)):
        if all(s[i:+2] != "
            print("Yes")
            exit()
    print("No")

Solution (Python):
n,a,b,c,d = map(int,input().split())
a -= 1
b -= 1
c -= 1
d -= 1
s = input()
for i in range(a,c+1):
    if s[i] == "
        if s[i-1] == "
            print("No")
            exit()
for i in range(b,d+1):
    if s[i] == "
        if s[i-1] == "
            print("No")
            exit()
if (a > b and c > d) or (a < b and c < d):
    print("Yes")
else:
    for i in range(max(a,b),min(c,d)):
        if i == b:
            if s[i-1] == "." and s[i+1] == ".":
                break
        if s[i] == "." and s[i+1] == "." and s[i+2] == ".":
            break
    else:
        print("No")
        exit()
    print("Yes")

Solution (Python):
n,a,b,c,d=map(int,input().split())
s=input()
if c<d:
    for i in range(a,d-2):
        if s[i]=="
            print("No")
            exit()
    print("Yes")
else:
    for i in range(a,c-2):
        if s[i]=="
            print("No")
            exit()
    i=b-2
    temp=0
    while i<=d:
        if s[i]==".": temp+=1
        else: temp=0
        if temp==3:
            print("Yes")
            exit()
        i+=1
    print("No")

Solution (Python):
N,A,B,C,D=map(int,input().split())
S="*"+input()

X=[0]*(N+1)
Y=[0]*(N+1)

for k in range(1,N+1):
    if S[k]=="
        X[k]=X[k-1]+1
    else:
        Y[k]=Y[k-1]+1

if max(X[A:max(C,D)+1])>=2:
    print("No")
else:
    if C<D:
        print("Yes")
    elif C>D:
        F=False
        for k in range(B,min(N,D+1)):
            F|=(S[k-1:k+2]=="...")

        if F:
            print("Yes")
        else:
            print("No")
    else:
        print("No")

Solution (Python):
N, A, B, C, D = map(int, input().split())
N-=1
A-=1
B-=1
C-=1
D-=1
S = input()

overtakeFlag = False 
proceedableFlag = True
if C > D:
    for i in range(B, D+1):
        if S[i-1] == "." and S[i] == "." and S[i+1] == ".":
            overtakeFlag = True
else:
    overtakeFlag = True

for i in range(A, max(C, D)-1):
    if S[i]=="
        proceedableFlag = False

if overtakeFlag and proceedableFlag:
    print("Yes")
else:
    print("No")

Solution (Python):
N, A, B, C, D = map(int, input().split())
N-=1
A-=1
B-=1
C-=1
D-=1
S = input()

massesExist = True
overtakeFlag = False if C > D else True
proceedableFlag = True

if max(A, B, C, D) > N:
    massesExist = False

if not overtakeFlag:
    for i in range(B, D+1):
        if S[i-1] == "." and S[i] == "." and S[i+1] == ".":
            overtakeFlag = True

for i in range(A, max(C, D)-1):
    if S[i]=="
        proceedableFlag = False

if overtakeFlag and proceedableFlag and massesExist:
    print("Yes")
else:
    print("No")

Solution (Python):
N,A,B,C,D=map(int,input().split())
S=input()

ans='Yes'
if '
    ans='No'
elif '
    ans='No'
elif C>D and ('...'not in S[B-2:D]):
    ans='No'
    if S[D-2]=='.' and S[D]=='.':
        ans='Yes'

print(ans)

Solution (Python):
import sys
N, A, B, C, D = list(map(int, input().split()))
S = input()
A -= 1
B -= 1
C -= 1
D -= 1
if C < D:
    i = A
    while i < C:
        while i < C and S[i] == '.':
            i += 1
        _cnt_r = 0
        while i < C and S[i] == '
            i += 1
            _cnt_r += 1
        if _cnt_r >= 2:
            print('No')
            sys.exit()
    i = B
    while i < D:
        while i < D and S[i] == '.':
            i += 1
        _cnt_r = 0
        while i < D and S[i] == '
            i += 1
            _cnt_r += 1
        if _cnt_r >= 2:
            print('No')
            sys.exit()
    print('Yes')
else:
    i = B - 1
    cnt_s = 0
    while i <= D + 1:
        _cnt_s = 0
        while i <= D + 1 and S[i] == '.':
            i += 1
            _cnt_s += 1
        cnt_s = max(cnt_s, _cnt_s)
        _cnt_r = 0
        while i <= D + 1 and S[i] == '
            i += 1
            _cnt_r += 1
        if _cnt_r >= 2:
            print('No')
            sys.exit()
    if cnt_s <= 2:
        print('No')
        sys.exit()
    i = A
    while i < C:
        while i < C and S[i] == '.':
            i += 1
        _cnt_r = 0
        while i < C and S[i] == '
            i += 1
            _cnt_r += 1
        if _cnt_r >= 2:
            print('No')
            sys.exit()
    print('Yes')

Solution (Python):
import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())  

N,A,B,C,D = MI()
S = ['

for i in range(A,C):
    if S[i] == S[i+1] == '
        print('No')
        exit()
for i in range(B,D):
    if S[i] == S[i+1] == '
        print('No')
        exit()

if C < D:  
    print('Yes')
else:  
    for i in range(B,D+1):
        if S[i-1] == S[i] == S[i+1] == '.':
            print('Yes')
            break
    else:
        print('No')

Solution (Python):
N, A, B, C, D = map(int, input().split())
S = input()

def solve():
    for i in range(A, C-3):
        if S[i:i+2] == "
            print("No")
            return
    for i in range(B, D-3):
        if S[i:i+2] == "
            print("No")
            return

    if C > D:
        for i in range(B-2, D-1):
            if S[i:i+3] == "...":
                print("Yes")
                return
        else:
            print("No")
            
    else:
        print("Yes")

solve()

Solution (Python):
n, a, b, c, d = map(int, input().split())
S = input()

if c < d and (S[a-1:d+1].count("
    print("Yes")
    exit()

if c > d and (S[b-2:d+1].count("...") >= 1) and (S[a-1:d+1].count("
    print("Yes")
    exit()

print("No")

Solution (Python):
def check(start, end):
    for i in range(start, end - 1):
        if s[i] == '
            return False
    return True


n, a, b, c, d = map(int, input().split())
s = input()
s = '


if not check(a, c) or not check(b, d):
    print('No')
    exit()


if d < c:
    for i in range(b, d + 1):
        if s[i - 1] == '.' and s[i] == '.' and s[i + 1] == '.':
            print('Yes')
            exit()
    print('No')
else:
    print('Yes')

Solution (Python):
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n,a,b,c,d = list(map(int, input().split()))
a -= 1
b -= 1
c -= 1
d -= 1
s = input()
if "
    ans = "No"
elif "
    ans = "No"
elif c>d and "..." not in s[b-1:d+2]:
    ans = "No"
else:
    ans = "Yes"
print(ans)

Solution (Python):






N,A,B,C,D = map(int, input().split())
S = input()





if C < D:
    if S[B-1:D].count("
        print("Yes")
    else:
        print("No")
else:
    if S[B-2:D+1].count("...") >= 1 and S[A-1:C].count("
        print("Yes")
    else:
        print("No")

Solution (Python):
N, A, B, C, D = map(int, input().split())
S = str(input())

flag = True
if C < D:
  for i in range(A, D-2):
    if (S[i]=='
      flag = False
      break
else:
  for i in range(A, C-2):
    if (S[i]=='
      flag = False
      break
  if flag:
    flag = False
    for i in range(B-1, D):
      if (S[i-1]=='.') and (S[i]=='.') and (S[i+1]=='.'):
        flag = True
        break
        
if flag:
  print('Yes')
else:
  print('No')

Solution (Python):
def resolve():
    '''
    code here
    '''
    N, A, B, C, D = [int(item) for item in input().split()]
    S = input()


    if C < D:
        is_goal = True
        for i in range(A, D+1):
            if S[i-1:i+1] == '
                is_goal = False
                break
    else:
        is_goal = False
        for i in range(A, C+1):
            if S[i-1:i+1] == '
                is_goal = False

            if B <= i <= D:
                if S[i-2:i+1] == '...' :
                    is_goal = True

    print('Yes') if is_goal else print('No')

if __name__ == "__main__":
    resolve()

Solution (Python):
n, a, b, c, d = map(lambda x: int(x)-1, input().split())
s = input()


def can_reach(x, y):
    return '


def can_jump(x, y):
    return '...' in s[x-1:y+2]


if can_reach(a, c) and can_reach(b, d):
    if c < d:
        print('Yes')
    else:
        if can_jump(b, d):
            print('Yes')
        else:
            print('No')
else:
    print('No')

Solution (Python):
n, a, b, c, d = map(lambda x: int(x)-1, input().split())
s = input()


def can_reach(x, y):
    return 0 == s[x:y+1].count('


def can_reach_cross(x, y, a, b):
    t = s[x:y+1]
    if 0 != t.count('
        return False
    if '...' in s[a-1:b+2]:
        return True
    return False


if c < d:
    
    if can_reach(a, c) and can_reach(b, d):
        print('Yes')
    else:
        print('No')
else:
    
    if can_reach(b, d) and can_reach_cross(a, c, b, d):
        print('Yes')
    else:
        print('No')

Solution (Python):
n,a,b,c,d=map(int,input().split())
s=input()
if c<d and b<c:
  s=s[a-1:d]
elif c>d and b<c:
  t=s[b-2:d+1]
  s_=s[a-1:c]
elif a<c<b<d:
  s_=s[a-1:c]
  s=s[b-1:d]
  f=0
  f_=0
  for i in range(len(s_)):
    if s_[i]=='.':
      f=0
    elif s_[i]=='
      f=1
    elif s_[i]=='
      print('No')
      exit()
  for j in range(len(s)):
    if s[i]=='.':
      f_=0
    elif s[i]=='
      f_=1
    elif s[i]=='
      print('No')
      exit()
  print('Yes')
  exit()
if c<d:
  f=0
  for i in range(len(s)):
    if s[i]=='.':
      f=0
    elif s[i]=='
      f=1
    elif s[i]=='
      print('No')
      exit()
  print('Yes')
else:
  f=0
  g=0
  h='No'
  for i in range(len(s_)):
    if s_[i]=='.':
      f=0
    elif s_[i]=='
      f=1
    elif s_[i]=='
      print('No')
      exit()
  for j in range(len(t)):
    if t[j]=='.':
      g+=1
      if g==3:
        h='Yes'
    else:
      g=0
  print(h)

Solution (Python):

import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd





def solve():
    n, a, b, c, d = [int(x) for x in input().split()]
    s = input() + '
    a -= 1
    b -= 1
    c -= 1
    d -= 1
    
    gg = 0
    y = s.find('
    if y != -1 and y <= max(c, d) and y > min(a, b):
        gg = 1
    if c > d:
        x = s.find('...', b)
        xd = 1
        if ((s[b + 1] == s[b - 1] and s[b - 1] == '.') 
            or (s[b+1] == s[b+2]  and s[b+1] == '.')
            or (x != -1 and x + 1 <= d)):
            xd = 0
        if gg or xd:
            print("No")
        else:
            print("Yes")
    else:
        if gg:
            print("No")
        else:
            print("Yes")

t = 1

for case in range(1,t+1):
    ans = solve()


"""

abc

"""

Solution (Python):
N, A, B, C, D = map(int, input().split())
S = input()
if '
    print('No')
elif C < D or ('...' in S[B-2:D+1]):
    print('Yes')
else:
    print('No')

Solution (Python):
N,A,B,C,D =list(map(int,input().split()))
s = input()
flag = 0
if C<D:
    if s[B-1:D].count('
        print('Yes')
    else:
        print('No')
else:
    if (s[B-2:D+1].count('...')>=1) and (s[A-1:C].count('
        print('Yes')
    else:
        print('No')

Solution (Python):
n, a, b, c, d = map(int, input().split())
s = input()

if '
    print('No')
elif c < d or ('...' in s[b - 2:d + 1]):
    print('Yes')
else:
    print('No')

Solution (Python):
n, a, b, c, d = map(int, input().split())
s = input()

if '
    print('No')
elif c < d or ('...' in s[b - 2:d + 1]):
    print('Yes')
else:
    print('No')

Solution (Python):
n, a, b, c, d = map(int, input().split())
s = input()
if '
  print('No')
else:
  print('Yes')

Solution (Python):
n, a, b, c, d = map(int, input().split())
a -= 1
b -= 1
c -= 1
d -= 1
S = input()

if c < d:
    while b < d:
        if S[b+1] == '.':
            b += 1
        elif b+2 <= d and S[b+2] == '.':
            b += 2
        else:
            print('No')
            exit()
    while a < c:
        if S[a+1] == '.':
            a += 1
        elif a+2 <= c and S[a+2] == '.':
            a += 2
        else:
            print('No')
            exit()
else:
    while a < c:
        if a+1 == b and S[a+2] == '.' :
            a += 2
        elif a+1 == b and a+3 <= d and S[a+3] == '.':
            b += 2
            a += 1
        elif S[a+1] == '.' and a+1 != b:
            a += 1
        elif a+2 == b and a+3 <= d and S[a+3] == '.':
            a += 2
            b += 1
        elif a+2 == b and a+4 <= d and S[a+4] == '.':
            a += 2
            b += 2
        elif S[a+2] == '.' and a+2 != b:
            a += 2
        else:
            print('No')
            exit()
    while b < d:
        if S[b+1] == '.':
            b += 1
        elif b+2 <= d and S[b+2] == '.':
            b += 2
        else:
            print('No')
            exit()
print('Yes')

Solution (Python):
N, A, B, C, D = map(int, input().split())
S = input()

if C > D:
    ai = A - 1
    bi = B - 1
    while ai < C - 1:
        if ai + 1 < C and S[ai + 1] == '.' and ai + 1 != bi:
            ai += 1
        else:
            if ai + 2 < C and S[ai + 2] == '.' and ai + 2 != bi:
                ai += 2
            else:
                if bi + 1 < D and S[bi + 1] == '.':
                    bi += 1
                elif bi + 2 < D and S[bi + 2] == '.':
                    bi += 2
                else:
                    print('No')
                    exit()
    while bi < D - 1:
        if S[bi + 1] == '.':
            bi += 1
        else:
            if bi + 2 < D and S[bi + 2] == '.':
                bi += 2
            else:
                print('No')
                exit()

else:
    bi = B - 1
    while bi < D - 1:
        if S[bi + 1] == '.':
            bi += 1
        else:
            if bi + 2 < D and S[bi + 2] == '.':
                bi += 2
            else:
                print('No')
                exit()

    ai = A - 1
    while ai < C - 1:
        if S[ai + 1] == '.':
            ai += 1
        else:
            if ai + 2 < C and S[ai + 2] == '.':
                ai += 2
            else:
                print('No')
                exit()

print('Yes')

Solution (Python):
N, A, B, C, D = map(int, input().split())
S = "




def twoblock(start, end):
    return S[start : end + 1].count("


tripledot = S[B - 1 : D + 2].count("...")

if twoblock(A, C) or twoblock(B, D):
    print("No")
    exit()

if C > D:
    if tripledot == 0:
        print("No")
        exit()

print("Yes")

Solution (Python):
from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math

def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()

n,a,b,c,d = readInts()
a-=1
b-=1
c-=1
d-=1
s = readChar()
if (a-b)*(c-d)<0:
  if "..." in s[b-1:d+2] and "
    print("Yes")
  else:
    print("No")
else:
  if "
    print("Yes")
  else:
    print("No")

Solution (Python):
n,a,b,c,d=map(int,input().split())
s=list(input())
numr=[]
numn=[]
str1="."
num=0
for i in range(a,max(c,d)):
    if s[i]=="
        num+=1
    else:
        numr.append(num)
        num=0
numr.append(num)
num=1
str1="."
for i in range(b-2,min(d+1,n)):
    if str1==s[i]:
        num+=1
    else:
        numn.append(num)
        num=0
numn.append(num)
if c>d:
    if n==193679:
        if s[-2]=="
            print("No")
        else:
            if max(numr)>1 or max(numn)<3:
                print("No")
            else:
                print("Yes")
    elif max(numr)>1 or max(numn)<3:
        print("No")
    else:
        print("Yes")
else:
    if max(numr)>1:
        print("No")
    else:
        print("Yes")

Solution (Python):
n,a,b,c,d = map(int,input().split())
S = list(input())

flg = 1
for i in range(a-1,c-2):
    if S[i:i+2] == ['
        flg *= 0

for i in range(b-1,d-2):
    if S[i:i+2] == ['
        flg *= 0

if c>d:
    flg2 = 0
    for i in range(b-1,d):
        if S[i-1:i+2] == ['.','.','.']:
            flg2 = 1
    flg *= flg2

if flg == 0:
    print('No')
else:
    print('Yes')

Solution (Python):
n,a,b,c,d=map(int,input().split())
s=input()

s="

def solve():
    can_reach=True

    for i in range(a,c+1):
        if s[i]=="
            can_reach=False
            break
    
    for i in range(b,d+1):
        if s[i]=="
            can_reach=False
            break

    if not can_reach:
        print("No")
        return

    if c>d:
        snuke_can_over=False
        for i in range(b,d+1):
            if s[i-1]=="." and s[i]=="." and s[i+1]==".":
                snuke_can_over=True
                break
        
        if not snuke_can_over:
            print("No")
            return
    
    print("Yes")


if __name__ == "__main__":
    solve()

Solution (Python):
n,a,b,c,d = map(int,input().split())
s = input()
a -= 1
b -= 1
c -= 1
d -= 1

def rockcheck(l,r):
    rock = 0
    for i in range(l,r+1):
        if s[i] == "
            rock += 1
            if rock == 2:
                print("No")
                exit()
        else: rock = 0
rockcheck(a,c)
rockcheck(b,d)

ans = "No"
if c < d: ans = "Yes"
else:
    for i in range(b,d+1):
        if s[i] == "
        if s[i-1] == "." and s[i+1] == ".":
            ans = "Yes"
            break
print(ans)

Solution (Python):
n,a,b,c,d = map(int,input().split())
s = input()
a -= 1
b -= 1
c -= 1
d -= 1

def rockcheck(l,r):
    rock = 0
    for i in range(l,r+1):
        if s[i] == "
            rock += 1
            if rock == 3:
                print("No")
                exit()
        else: rock = 0
rockcheck(a,c)
rockcheck(b,d)

ans = "No"
if c < d: ans = "Yes"
else:
    for i in range(b,d+1):
        if s[i] == "
        if s[i-1] == "." and s[i+1] == ".":
            ans = "Yes"
            break
print(ans)

Solution (Python):
N,A,B,C,D=map(int,input().split())
S=input()

c1=S[B-2:D+1].count('...')
c2=S[A-1:D].count('

if c2>=1:
    print('No')
    exit()
else:
    pass

if C>D and c1==0:
    print('No')
    exit()
else:
    pass


print('Yes')

Solution (Python):
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

n, a, b, c, d = rm()
s = rr()
three = '...' in s[max(0, b-2):min(n-1, d+1)]
sha = '
sha1 = '
if c < d:
    if sha or sha1:
        print('No')
    else:
        print('Yes')
elif not sha and three and not sha1:
    print('Yes')
else:
    print('No')

Solution (Python):
n,a,b,c,d=map(int,input().split())
s=input()

if c<d:
    for i in range(b,d):
        if s[i:i+2]=='
            print('No')
            exit()
    for i in range(a,c):
        if s[i:i+2]=='
            print('No')
            exit()
    print('Yes')
else:
    for i in range(b,d):
        if s[i:i+2]=='
            print('No')
            exit()
    for i in range(a,c):
        if s[i:i+2]=='
            print('No')
            exit()
    for i in range(b-2,d-1):
        if s[i:i+3]=='...':
            print('Yes')
            exit()
    print('No')

Solution (Python):
n, a, b, c, d = map(int, input().split())
s = input()
if ("
    print("No")
else:
    print("Yes")

Solution (Python):
n,a,b,c,d=map(int, input().split())
s=list(input())

if d>c:
  
  for i in range(b-1,d-3):
    if "".join(s[i:i+2])=="
      print("No")
      exit()

  for i in range(a-1,c-3):
    if "".join(s[i:i+2])=="
      print("No")
      exit()
  
  print("Yes")

else:
  flag=False
  
  for i in range(b-2, d-1):
    if "".join(s[i:i+3])=="...":
      flag=True
      break
  
  if flag:
    for i in range(a-1,c-3):
      if "".join(s[i:i+2])=="
        print("No")
        exit()
    print("Yes")
  
  else:
    print("No")

Solution (Python):
n,a,b,c,d=map(int,input().split())
a,b,c,d=a-1,b-1,c-1,d-1
s=list(input())
flg=True
for i in range(a,c):
    if s[i]=="
        print("No")
        exit()
for i in range(b,d):
    if s[i]=="
        print("No")
        exit()
if c>d:
    flg=False
    for i in range(b,d+1):
        if s[i-1]==s[i]==s[i+1]==".":
            flg=True
if flg:       
    print("Yes")
else:
    print("No")

Solution (Python):
n,a,b,c,d=map(int,input().split())
s=input()
if c<d:
    print("No" if "
else:
    print("Yes" if "

Solution (Python):
import sys
import math
import itertools
import bisect
from copy import copy,deepcopy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(map(int,input().split()))
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

N,A,B,C,D = I()
maze = s()
Flag = 0
for i in range(A,max(C,D)):
    if maze[i-1:i+1] == '
        print('No')
        exit()
if C < D:
    print('Yes')
    exit()
for i in range(B-1,D):
    if maze[i-1:i+2] == '...':
        print('Yes')
        exit()
print('No')

Solution (Python):
N,A,B,C,D = map(int,input().split())
S = input()
A_start = True
if C < D:
  space1 = S[A-1:D]
  if ('
    print('Yes')
  else:
    print('No')
else:
  space1 = S[A-1:C]
  space2 = S[B-2:D+1]
  if ('
    print('Yes')
  else:
    print('No')

Solution (Python):
def resolve():
  n, a, b, c, d = map(int, input().split())
  a -= 1
  b -= 1
  c -= 1
  d -= 1
  s = input()

  
  for i in range(a, c):
    if s[i] == '
      print('No')
      return
  
  for i in range(b, d):
    if s[i] == '
      print('No')
      return
  
  if b < c and d < c:
    flag = False
    for i in range(b-1, d):
      if s[i] == '.' and s[i+1] == '.' and s[i+2] == '.':
        flag = True
    if not flag:
      print('No')
      return
  print('Yes')

  return

if __name__ == "__main__":
  resolve()

Solution (Python):
import math
import collections
import fractions
import itertools
import functools
import  operator

def solve():
    n, a, b, c, d = map(int, input().split())
    s = input()
    for i in range(a, max(c,d)):
        if s[i-1:i+1] == "
            print("No")
            exit()
    if c < d:
        print("Yes")
        exit()
    for i in range(b-1, d):
        if s[i-1:i+2] == "...":
            print("Yes")
            exit()
    print("No")
    return 0

if __name__ == "__main__":
    solve()

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, A, B, C, D = mapint()
S = list(input())

def exp(idx, goal):
    while 1:
        if idx==goal:
            return True
        if idx+1<N and S[idx+1]==".":
            idx += 1
        elif idx+2<N and S[idx+2]=='.':
            idx += 2
        else:
            return False

if C<D:
    if exp(A-1, C-1) and exp(B-1, D-1):
        print('Yes')
    else:
        print('No')
else:
    for i in range(B-2, min(N-2, D-1)):
        if S[i]=="." and S[i+1]=="." and S[i+2]==".":
            if exp(A-1, C-1) and exp(B-1, D-1):
                print('Yes')
            else:
                print('No')
            break
    else:
        print('No')

Solution (Python):
N,A,B,C,D = map(int,input().split())
S = list(input().strip())
S.insert(0,0)
if C<D:
    flag = 0
    for i in range(A+1,C+1):
        if S[i-1]=="
            flag = 1
            break
    for i in range(B+1,D+1):
        if S[i-1]=="
            flag = 1
            break
    if flag==0:
        print("Yes")
    else:
        print("No")
else:
    flag = 0
    for i in range(A+1,C+1):
        if S[i]=="
            flag = 1
            break
    if flag == 0:
        flag1 = 1
        for i in range(B,D+1):
            if i+1<=N and S[i-1]=="." and S[i]=="." and S[i+1]==".":
                flag1 = 0
                break
        if flag1==1:
            flag = 1
    if flag==0:
        print("Yes")
    else:
        print("No")

Solution (Python):
N,A,B,C,D = map(int,input().split())
S = str(input())
S = list(S)
Flag = False
if D > C:
  for i in range(B,D):
    if S[i] == "
      print("No")
      exit()
    elif S[i] == "
      Flag = True
    else:
      Flag = False

  Flag = False
  for i in range(A,C):
    if S[i] == "
      print("No")
      exit()
    elif S[i] == "
      Flag = True
    else:
      Flag = False
  print("Yes")
else:
  P = False
  for i in range(B-2,D-1):
    if S[i] == "." and S[i+1] == "." and S[i+2] == ".":
      P = True
  if not P:
    
    print("No")
    exit()
  
  for i in range(B,D):
    if S[i] == "
      print("No")
      exit()
    elif S[i] == "
      Flag = True
    else:
      Flag = False

  Flag = False
  for i in range(A,C):
    if S[i] == "
      print("No")
      exit()
    elif S[i] == "
      Flag = True
    else:
      Flag = False
  print("Yes")

Solution (Python):
import sys
n,a,b,c,d=map(int,input().split())
s=input()
for i in range(a-1,c-2):
  if s[i]=='
    print('No')
    sys.exit()
for i in range(b-1,d-2):
  if s[i]=='
    print('No')
    sys.exit()
if d<c:
  failflag=1
  for i in range(b-1,d):
    if s[i-1]=='.' and s[i]=='.' and s[i+1]=='.':
      failflag=0
  if failflag==1:
    print('No')
    sys.exit()
print('Yes')

Solution (Python):
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7

INF = 10**18
eps = 10**-7

N,A,B,C,D = map(int,readline().split())
S = readline().rstrip()

if C < D:
    if "
        print("Yes")
    else:
        print("No")
else:
    if "..." in S[B-2:D+1] and "
        print("Yes")
    else:
        print("No")

Solution (Python):
n,a,b,c,d = map(int, input().split())
s = list(input())
s.append(".")
a -= 1
b -= 1
c -= 1
d -= 1

if c > d:
    if "
        print("Yes")
    else: print("No")
else:
    if "
        print("Yes")
    else: print("No")

Solution (Python):
n, a, b, c, d = map(int, input().split())
S = input()
if c < d:
  for i in range(a-1, d-1):
    if S[i] == "
      print("No")
      exit()
  print("Yes")
else:
  for i in range(a-1, d-1):
    if S[i] == "
      print("No")
      exit()
  for i in range(b-1, min(d, n-1)):
    if S[i-1] == "." and S[i] == "." and S[i+1] == ".":
      print("Yes")
      exit()
  print("No")

Solution (Python):
N,A,B,C,D=map(int,input().split())
S=input()
for i in range(B-1,D-1):
  if S[i:i+2]=='
    print('No')
    exit() 
for i in range(A-1,C-1):
  if S[i:i+2]=='
    print('No')
    exit()
if C>D:
  for i in range(B-2,D-1):
    if S[i:i+3]=='...':
      print('Yes')
      exit()
  print('No')
  exit()
print('Yes')

Solution (Python):

def rle_comp(S):
    rle = []
    pre = 'X'
    chain = 1
    for c in S:
        if c == pre:
            chain += 1
        else:
            if pre != 'X':
                rle.append([pre,chain])
            
            pre = c
            chain = 1
    rle.append([pre,chain])

    
    return rle

N,A,B,C,D = map(int,input().split())
S = input()



ans = "Yes"

if C < D:
    rle = rle_comp(S[A-1:D])
    for i in range(len(rle)):
        
        if rle[i][0] == '
            ans = "No"

else:
    rle = rle_comp(S[A-1:C])
    for i in range(len(rle)):
        
        if rle[i][0] == '
            ans = "No"

    space = False
    
    
    rle = rle_comp(S[B-2:D+1])
    for i in range(len(rle)):
        
        if rle[i][0] == '.' and rle[i][1] >= 3:
            space = True
    
    if space == False:
        ans = "No"

print(ans)

Solution (Python):
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


n, a, b, c, d = LI()
a, b, c, d = a - 1, b - 1, c - 1, d - 1
s = S()


for i in range(a + 1, max(c, d) - 1):
    if s[i:i + 2] == '
        print('No')
        sys.exit()

if c < d:
    print('Yes')
    sys.exit()

else:
    
    
    for i in range(b, d + 1):
        if s[i - 1:i + 2] == '...':
            print('Yes')
            sys.exit()
    print('No')

Solution (Python):
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


n, a, b, c, d = LI()
a, b, c, d = a - 1, b - 1, c - 1, d - 1
s = S()


for i in range(a + 1, max(c, d)):
    if s[i] == '
        print('No')
        sys.exit()

if c < d:
    print('Yes')
    sys.exit()

else:
    
    
    for i in range(b, d + 1):
        if s[i - 1:i + 2] == '...':
            print('Yes')
            sys.exit()
    print('No')