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):

n,a,b,c,d=map(int,input().split())
s=input()
s="X"+s+"X"

def judge1(a,b):
    flag=False
    counterx=0
    countero=0
    for i in range(a,b+1):
        if s[i]=="." and s[i-1]=="." and s[i+1]==".":
            flag=True
            break
    return flag
def judge2(a,b):
    flag=True
    for i in range(a-1,b-1):
        if s[i]=="
            flag=False
            break
    return flag
if c<d:
    if judge2(a,c) and judge2(b,d):
        print("Yes")
    else:
        print("No")
elif d<c:
    if judge1(b,d) and judge2(a,c):
        print("Yes")
    else:
        print("No")

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

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

Solution (Python):
def solve(s, a, b, c, d):
    if '
        return False
    if '
        return False

    
    

    
    if c < b:
        return True

    
    if c < d:
        return True

    
    return '...' in s[b - 1:d + 2]


if __name__ == '__main__':
    n, *args = map(int, input().split())
    a, b, c, d = map(lambda x: x - 1, args)

    s = input()

    print('Yes' if solve(s, a, b, c, d) else 'No')

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

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

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

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

while funuke < D:
    if S[funuke + 1] == '.':
        funuke += 1
    else:
        if S[funuke + 2] == '.':
            funuke += 2
        else:
            print('No')
            exit()
while sunuke < C:
    if S[sunuke + 1] == '.':
        sunuke += 1
    else:
        if S[sunuke + 2] == '.':
            sunuke += 2
        else:
            print('No')
            exit()

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

Solution (Python):
def resolve():
    n, a, b, c, d = list(map(int, input().split()))
    s = input()
    if "
        print("No")
        return 0

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


if __name__ == "__main__":
    resolve()

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

a -= 1; b -= 1; c -= 1; d -= 1


if c < d:
    for i in range(a, d-1):
        if s[i] == "
            print("No")
            exit()
    print("Yes")


elif d < c:
    flag_a = False
    for i in range(b, d+1):
        if s[i-1] == "." and s[i] == "." and s[i+1] == ".":
            flag_a = True

    flag_b = True
    for i in range(a, d-1):
            if s[i] == "
                flag_b = False

    if flag_a and flag_b:
        print("Yes")
    else:
        print("No")

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

ans='Yes'
if d>c:
    check=0
    for i in range(a,d):
        if s[i]=='.':
            check=0
        else:
            check+=1
            if check==2:
                ans='No'
else:
    check=0
    for i in range(a,c):
        if s[i]=='.':
            check=0
        else:
            check+=1
            if check==2:
                ans='No'
    check=0
    for i in range(b-2,d+1):
        if s[i]=='.':
            check+=1
            if check==3:
                break
        else:
            check=0
    if check!=3:
        ans='No'
print(ans)

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

ans='Yes'
if d>c:
    check=0
    for i in range(a,d):
        if s[i]=='.':
            check=0
        else:
            check+=1
            if check==2:
                ans='No'
else:
    check=0
    for i in range(a,c):
        if s[i]=='.':
            check=0
        else:
            check+=1
            if check==2:
                ans='No'
    check=0
    for i in range(b-2,d+1):
        if s[i]=='.':
            check+=1
            if check==3:
                break
        else:
            check=0
    if check!=3:
        ans='No'
print(ans)

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

if '
    ans = 'No'
elif '
    ans = 'No'
elif A < B and C > D:
    if '...' not in S[B-2:min(C, D)+1]:
        ans = 'No'

print(ans)

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

if (b-a)*(d-c)>0 and max(a,b) < min(c,d):
  for i in range(min(a,b)-1,max(c,d)):
    if s[i]=='
      print('No')
      exit()
  print('Yes')

elif (b-a)*(d-c)>0 and max(a,b) > min(c,d):
  for i in range(a-1,c):
    if s[i]=='
      print('No')
      exit()
  for i in range(b-1,d):
    if s[i]=='
      print('No')
      exit()
  print('Yes')
 
else:
  for i in range(min(a,b)-1,max(c,d)):
    if s[i]=='
      print('No')
      exit()
  for i in range(max(a,b)-1,min(c,d)):
    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()
s = "." + s

def aa():
    for i in range(a, c):
        if s[i:i+2] == "
            return "No"
    for i in range(b, d):
        if s[i:i+2] == "
            return "No"
    if c > d:
        for i in range(b-1, d):
            if s[i:i+3] == "...":
                return "Yes"
        return "No"
    else:
        return "Yes"

print(aa())

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

if D<C:
    f=False
    for i in range(B-1,D):
        if S[i:i+3]=='...':
            f=True
else:
    f=True

if f:
    for i in range(A+1,C-1):
        if S[i:i+2]=='
            f=False
    for i in range(B+1,D-1):
        if S[i:i+2]=='
            f=False

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

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

if "
  print("No")
elif D>C:
  print("Yes")
else:
  if "..." in S[B-2:min(C,D)+1]:
    print("Yes")
  else:
    print("No")

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

Solution (Python):
n, a, b, c, d = map(int, input().split())
a -= 1
b -= 1
c -= 1
d -= 1
s = input().rstrip()
if c < d:
    s = s[a:d]
    for c0, c1 in zip(s, s[1:]):
        if c0 == c1 == '
            print('No')
            break
    else:
        print('Yes')
else:
    ok = False
    for i in range(b - 1, d):
        if i + 2 < n and s[i] == s[i + 1] == s[i + 2] == '.':
            ok = True
            break
    else:
        print('No')
    if ok:
        s = s[a:c]
        for c0, c1 in zip(s, s[1:]):
            if c0 == c1 == '
                print('No')
                break
        else:
            print('Yes')

Solution (Python):


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

"""
ABDCとか順番が逆転するなら3つ以上連続の空きがないとアウト
ABCDならAからDにいけないとアウト ACBDの可能性があるので注意
"""
if C<D:
    if C<B:
        if "
            print("No")
        else:
            print("Yes")
    else:
        if "
            print("No")
        else:
            print("Yes")
else:
    if "..." in S[A:C+1] and not "
        if S[B+1]=="
            print("No")
        elif S[D-1]=="
            print("No")
        else:
            print("Yes")
    else:
        print("No")

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

if c < b:
    pre = '.'
    for i in range(a, c):
        if pre == '
            print('No')
            exit()
        pre = s[i]
    pre = '.'
    for i in range(b, d):
        if pre == '
            print('No')
            exit()
        pre = s[i]
elif c < d:
    pre = '.'
    for i in range(a, d):
        if pre == '
            print('No')
            exit()
        pre = s[i]
else:
    pre = '.'
    prepre = '
    three = False
    for i in range(a, c):
        if pre == '
            print('No')
            exit()
        if b <= i <= d and prepre == '.' and pre == '.' and s[i] == '.':
            three = True
        prepre = pre
        pre = s[i]
    if three == False:
        print('No')
        exit()
print('Yes')

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

con = True
for i in range(a,d+1):
    if s[i-1]=="
        print("No")
        con = False
        break

if (con):
    if (c<b) or (c<d):
        print("Yes")
        con = False

if (con):
    for i in range(b-1,d):
        if s[i]=="." and s[i+1]=="." and s[i+2]==".":
            print("Yes")
            con = False
            break

if (con):
    print("No")

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

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

if "
  print("No")
  exit()




if C < D:
  print("Yes")
  exit()


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

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

s=input()

if C<D:
    if not "
        ans="Yes"
    else:
        ans="No"
elif D<C:
    if not "
        if "..." in s[B-1:D+2]:
            ans="Yes"
        else:
            ans="No"
    else:
        ans="No"

print(ans)

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

s=input()

if A<B<C<D:
    if not "
        if not "
            ans="Yes"
        else:
            ans="No"
    else:
        ans="No"
elif A<B<D<C:
    if not "
        if s[B-1]!="
            ans="Yes"
        elif "..." in s[B:D+1]:
            ans="Yes"
        elif s[D-1]!="
            ans="Yes"
        else:
            ans="No"
    else:
        ans="No"
elif A<C<B<D:
    if "
        ans="No"
    else:
        ans="Yes"
print(ans)

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

if "
  print("No")
  exit()
elif C > D and "..." not in s[B-2:D+1]:
  print("No")
  exit() 
print("Yes")

Solution (Python):


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


def two_rocks(li):
    if "
        return True
    else:
        return False


def three_spaces(li):
    if "..." in li:
        return True
    else:
        return False


def solve():
    if two_rocks(s[a-1:c-1]):
        return False
    if two_rocks(s[b-1:d-1]):
        return False
    if d < c:
        if three_spaces(s[b-2:d+1]):
            return True
        else:
            return False
    else:
        return True


ans = "Yes" if solve() else "No"
print(ans)

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

flag = True
for i in range(min(a-1, b-1), max(c, d)-1):
    if s[i] == '
        flag = False

if c > d:
    flag2 = False
    for i in range(b-1, d):
        if s[i-1] == '.' and s[i] == '.' and s[i+1] == '.':
            flag2 = True
else:
    flag2 = True

if flag and flag2:
    print('Yes')
else:
    print('No')

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

A -= 1
B -= 1
C -= 1
D -= 1


def moveA(A, dest=True):
    if A == C:
        return A, True
    elif dest is True and A+1 == C and B != A+1:
        A += 1
    elif dest is True and A+2 == C and B != A+2:
        A += 2
    elif A+1 < N and S[A+1] == "." and B != A+1:
        A += 1
    elif A+2 < N and S[A+2] == "." and B != A+2:
        A += 2
    else:
        return A, True

    return A, False


def moveB(B, dest=True):
    if B == D:
        return B, True
    elif dest is True and B+1 == D and A != B+1:
        B += 1
    elif dest is True and B+2 == D and A != B+2:
        B += 2
    elif B+1 < N and S[B+1] == "." and A != B+1:
        B += 1
    elif B+2 < N and S[B+2] == "." and A != B+2:
        B += 2
    else:
        return B, True

    return B, False


if C < D:
    while B != D:
        B, stop = moveB(B)
        if stop:
            break
        

    while A != C:
        A, stop = moveA(A)
        if stop:
            break
        
else:
    while A < B and A != C:
        A, stop = moveA(A, dest=False)
        if stop:
            B, stop = moveB(B, dest=False)
            if stop:
                
                
                
                
                
                
                
                
                
                
                
                
                break
        

    while A != C:
        A, stop = moveA(A)
        if stop:
            
            break
        

    while B != D:
        B, stop = moveB(B)
        if stop:
            
            break
        

if A == C and B == D:
    print('Yes')
else:
    print('No')

Solution (Python):
n, a, b, c, d = map(int, input().split())
s = input()
if s[a-1:c].count('
    if c < d:
        print('Yes')
    elif s[b-2:d+1].count('...') >= 1:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Solution (Python):
import sys
from collections import defaultdict
sys.setrecursionlimit(200000)
input = sys.stdin.readline

N, A, B, C, D, = map(int, input().split())
L = list(input().strip())

A -= 1
B -= 1
C -= 1
D -= 1

m = [0] * N
m[A] = 1

for i in range(N):
    if m[i] > 0:
        if i + 1 < N and L[i + 1] == ".":
            m[i + 1] = 1

        if i + 2 < N and L[i + 2] == ".":
            m[i + 2] = 1

if m[C] == 0:
    print("No")
    exit()

m = [0] * N
m[B] = 1

for i in range(N):
    if m[i] > 0:
        if i + 1 < N and L[i + 1] == ".":
            m[i + 1] = 1

        if i + 2 < N and L[i + 2] == ".":
            m[i + 2] = 1

if m[D] == 0:
    print("No")
    exit()

if C > D:
    for i in range(B, D+1):
        if "
            print("Yes")
            exit()
    print("No")
else:
    print("Yes")

Solution (Python):
import sys

def I(): return(int(sys.stdin.readline()))
def LI(): return([int(x) for x in sys.stdin.readline().split()])
def S(): return(list(sys.stdin.readline())[:-1])

mod = 10**9+7
dd = ((-1,0),(1,0),(0,-1),(0,1))

def main():
    N,A,B,C,D = LI()
    s = S()

    for i in range(B-1,D-1):
        if s[i] == "
            return "No"

    if C<D:
        for i in range(A-1,C-1):
            if s[i] == "
                return "No"
        return "Yes"

    flag = False
    for i in range(B-2,D-1):
        if s[i] == "." and s[i+1] == "." and s[i+2] == ".":
            flag = True
    if flag:
        return "Yes"
    else:
        return "No"


if __name__ == "__main__":
    print(main())

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

if c < d:
    ok1 = not any(s[i] == s[i + 1] == '
    ok2 = not any(s[i] == s[i + 1] == '
    print('Yes' if ok1 and ok2 else 'No')
else:
    ok1 = not any(s[i] == s[i + 1] == '
    ok2 = not any(s[i] == s[i + 1] == '
    ok3 = any(s[i - 1] == s[i] == s[i + 1] == '.' for i in range(b, d + 1) if 0 < i and i < n - 1)
    print('Yes' if ok1 and ok2 and ok3 else 'No')

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


if (A-B)*(C-D) >= 1:  
    if S[min(A, B)-1:max(C, D)].find('
        print('Yes')
    else:
        print('No')
else:
    
    if S[min(A, B)-1:max(C, D)].find('
        print('Yes')
    else:
        print('No')

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


if (A-B)*(C-D) >= 1:  
    if S[min(A, B)-1:max(C, D)].find('
        print('Yes')
    else:
        print('No')
else:
    
    if S[min(A, B)-1:max(C, D)].find('
        print('Yes')
    else:
        print('No')

Solution (Python):
N, A, B, C, D = [int(i) for i in input().split()]
S = input()
ans = True

for i in range(A-1, max(C, D)):
    if S[i:i+2] == "
        ans = False
        break
else:
    if D < C:
        
        for i in range(B-2, D-1):
            if S[i:i+3] == "...":
                break
        else:
            ans = False
if ans:
    print("Yes")
else:
    print("No")

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

for i in range(A,max(C,D)-1):
    if S[i:i+2] == "
        print("No")
        exit(0)

if C > D:
    flag = False
    for i in range(B-1,D):
        if S[i-1:i + 2] == "...":
            flag = True
            break

    if flag == False:
        print("No")
        exit(0)

print("Yes")

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

for i in range(A,max(C,D)-1):
    if S[i:i+2] == "
        print("No")
        exit(0)

if C > D:
    flag = False
    for i in range(B-1,D):
        if S[i-1:i + 2] == "...":
            flag = True
            break

    if flag == False:
        print("No")
        exit(0)

print("Yes")

Solution (Python):


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

s=input()
if c<d:
    flag=True
else:
    flag=False

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

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

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

    
    
    
    
    
    

    for i in range(B, D-2):
        if S[i] + S[i+1] == "
            return 'No'
    for i in range(A, C-2):
        if S[i] + S[i+1] == "
            return 'No'

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

if __name__ == '__main__':
    print(main())

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

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

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

if __name__ == '__main__':
    print(main())

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

c = [1 if S[0] == '
for i in range(1, N):
    if c[-1] > 0:
        if S[i] == '
            c.append(c[-1] + 1)
        else:
            c.append(-1)
    else:
        if S[i] == '
            c.append(1)
        else:
            c.append(c[-1] - 1)

if A < B < C < D:
    ans = max(c[A:D + 1]) <= 1
elif A < B < D < C:
    ans = max(c[A:C + 1]) <= 1 and min(c[B + 1:D + 2]) <= -3
elif A < C < B < D:
    ans = max(c[A:C + 1]) <= 1 and max(c[B:D + 1]) <= 1
print('Yes' if ans else 'No')

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

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

for i in range(A, C-1):
    if S[i] == "
        print("No")
        exit()

for i in range(B, D-1):
    if S[i] == "
        print("No")
        exit()

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

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

    for i in range(a-1, d-1):
        if ss[i:i+2] == '
            print('No')
            return

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

Solution (Python):
def solve(A,B,C,D,S):  
  if S[C-1] == "
    print("No")
    exit()
  if (D<C):
    if "..." not in S[B-2:D+1]:
      print("No")
      exit()
  print("Yes")

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

Solution (Python):
import sys
input=sys.stdin.readline

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

if "
    print("No")
    exit()

if D < C:

    if "..." not in S[B-2:D+1]:
        print("No")
        exit()
print("Yes")

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

if '
    print('No')
    exit(0)

if C > D:
    if '...' not in S[B - 1: D + 2]:
        print('No')
        exit(0)

print('Yes')

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

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

if C > D:
    if '...' not in S[B - 1: D + 2]:
        print('No')
        exit(0)

print('Yes')

Solution (Python):
n, a, b, c, d = [ int(v)-1 for v in input().split() ]
n += 1
s = input()

def can_go(instr,l,r):
    s1 = instr[l:r+1]
    res =  all([ len(i) < 2 for i in s1.split(".") if i != ""])
    return res

def can_swap(instr,l,r):
    s1 = instr[l:r+1]
    res = any([ len(i) >= 3 for i in s1.split("
    return res

ans = "No"
if can_go(s,a,c) and can_go(s,b,d):
    if c < d:
        ans = "Yes"
    else:
        if can_swap(s,b-1,d+1):
            ans = "Yes"
print(ans)

Solution (Python):
import sys

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

sl=list(s)

sl[a-1]="A"
sl[b-1]="B"
sl[c-1]="a"
sl[d-1]="b"


if c>d:
    g_far=c
else:
    g_far=d


for i in range(a-1,g_far-2):
    if sl[i]=="
        print("No")
        sys.exit()



if c>d:
    for j in range(b-1-1,d-1):
        
        if sl[j] !="
            print("Yes")
            sys.exit()
else:
    print("Yes")
    sys.exit()

print("No")

Solution (Python):
n,a,b,c,d = map(int,input().split())
road = input()
if "
  print("No")
else:
  if c < d:
    print("Yes")
  else:
    flag = d == b+1 and road[b-2] == "
    if "..." in road[b-2:d+1] or flag:
      print("Yes")
    else:print("No")

Solution (Python):

def main():
    n, a, b, c, d = tuple(map(int, input().rstrip().split()))
    S = input().rstrip()
    flg1 = "
    flg2 = 1 if c < d else "..." in S[b - 2: d + 1]
    print("Yes" if flg1 and flg2 else "No")


if __name__ == "__main__":
    main()

Solution (Python):

def main():
    n, a, b, c, d = tuple(map(int, input().rstrip().split()))
    S = input().rstrip()
    if "
        flg = 0
    else:
        if c < d:
            flg = 1
        else:
            flg = "..." in S[b - 2 : d + 1]
    print("Yes" if flg else "No")


if __name__ == "__main__":
    main()

Solution (Python):
import sys
sys.setrecursionlimit(100000000)
def input():
    return sys.stdin.readline()[:-1]
from bisect import *
from collections import *
from heapq import *
from math import *
from copy import *

N, A, B, C, D = map(lambda x: int(x)-1, input().split())
S = input()
if "
    print('No')
    exit()
if C < D:
    print('Yes')
else:
    if "..." in S[B-1:D+2]:
        print('Yes')
    else:
        print('No')

Solution (Python):
import sys
sys.setrecursionlimit(10**9)

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

def compute(index, end):
    if inputs[index] == '
        return False
    if index == end:
        return True
    return compute(index+1, end) or compute(index+2, end)

flag = False
if A < C and C < B:
    flag = compute(A-1, C-1) and compute(B-1, D-1)
elif B < C < D:
    flag = compute(A-1, C-1) and compute(B-1, D-1)
elif D < C:
    for index in range(B-2, D-1):
        if (index != A - 1) and inputs[index] != '
            flag = True
    flag = flag and compute(A-1, C-1) and compute(B-1, D-1)

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

Solution (Python):
import sys
sys.setrecursionlimit(10**9)

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

def compute(index, end):
    if inputs[index] == '
        return False
    if index == end:
        return True
    return compute(index+1, end) or compute(index+2, end)

flag = False
if A < C and C < B:
    flag = compute(A-1, C-1) and compute(B-1, D-1)
elif B < C < D:
    flag = compute(A-1, C-1) and compute(B-1, D-1)
elif D < C:
    for index in range(B-2, D-1):
        if inputs[index] != '
            flag = True
    flag = flag and compute(A-1, C-1) and compute(B-1, D-1)

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

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

Solution (Python):
def solve():
    if '
        return False
    if b < c < d:
        return True  
    if c < b < d:
        return True  
    return '...' in s[b - 1:d + 2]  


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

s = input()

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

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

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

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

if d > c:
    S1 = S[a - 1:c]
    S2 = S[b - 1:d]
    if "
        print("No")
        exit()
    else:
        print("Yes")
        exit()

S1 = S[a - 1:c]
S2 = S[b - 1:d]
if "
    print("No")
    exit()

S3 = S[b - 2:d + 1]
if "..." in S3:
    print("Yes")
else:
    print("No")

Solution (Python):


import sys
import math
import bisect
from heapq import heappush, heappop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
mod = 10**9 + 7

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

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

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S(): return list(sys.stdin.readline())[:-1]
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 LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007


def A():
    n = I()
    b = LI()
    ans = []
    for j in range(n):
        for i in range(len(b))[::-1]:
            if b[i] == i+1:
                x = b.pop(i)
                ans.append(x)
                break
    if b:
        print(-1)
    else:
        print(*ans[::-1],sep = "\n")
    return


def B():
    n,a,b,c,d = LI()
    s = S()
    a -= 1
    b -= 1
    c -= 1
    d -= 1
    k = b
    while b < d:
        if s[b+1] == ".":
            b += 1
        else:
            if s[b+2] == "
                print("No")
                return
            b += 2
    b = k
    if c < d:
        while a < c:
            if s[a+1] == ".":
                a += 1
            else:
                if s[a+2] == "
                    print("No")
                    return
                a += 2
        print("Yes")
    else:
        for i in range(b-1,d):
            if s[i:i+3].count(".") == 3:
                print("Yes")
                return
        print("No")
    return


def C():
    n = I()

    return


def D():
    n = I()

    return


def E():
    n = I()

    return


def F():
    n = I()

    return


if __name__ == "__main__":
    B()

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

Solution (Python):
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n, a, b, c, d = li()
a -= 1
b -= 1
s = ns()

no2_ac = not "
no2_bd = not "
yes3_bd = "..." in s[b-1:d+1]

if c < d:
    print("Yes" if no2_ac and no2_bd else "No")

else:
    print("Yes" if no2_ac and no2_bd and yes3_bd else "No")

Solution (Python):
N,A,B,C,D=map(int,input().split())
S=list(input())
a=0
E=N-D
if C>D:
    for i in range(N-3):
        if S[i]=="
            for j in range(1,4):
                if S[i]==S[i+j]:
                    a=1
    if E==0:
        for i in range(B-2,D-2):
            if S[i]==".":
                if S[i]==S[i+1] and S[i+1]==S[i+2]:
                    a=0
                    break
    if E>=1:
        for i in range(B-2,D-1):
            if S[i]==".":
                if S[i]==S[i+1] and S[i+1]==S[i+2]:
                    a=0
                    break
for i in range(A,D):
    if S[i]=="
        if S[i+1]=="
            a=1
if a==0:
    print("Yes")
if a==1:
    print("No")