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 sys
n, a, b, c, d = [int(x) for x in input().split()]
s = input()
for i in range(a, max(c, d)):
    if s[i - 1: i + 1] == "
        print("No")
        sys.exit()
if c < d:
    print("Yes")
    sys.exit()
for i in range(b - 1, d):
    if s[i - 1:i + 2] == "...":
        print("Yes")
        sys.exit()
print("No")

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

AtoC = True
BtoD = True
replace = False

for n in list(range(A-1,C)):
    if S[n] =='
        AtoC = False
        
for n in list(range(B-1,D)):
    if S[n] =='
        BtoD = False
        
if C<D:
    if AtoC == True and BtoD == True:
        print('Yes')
    else:
        print('No')
else:
    for n in list(range(B-2,D-1)):
        if S[n] =='.' and S[n+1] == '.' and S[n+2] == '.':
            replace = True
    if AtoC == True and BtoD == True and replace == True:
        print('Yes')
    else:
        print('No')

Solution (Python):
N,A,B,C,D = map(int,input().split())
S = input()
ans = "Yes"
iwa = 0
for i in S[A-1:C]:
    if i == "
        iwa += 1
        if iwa > 1:
            ans = "No"
    else:
        iwa = 0
iwa = 0
for i in S[B-1:D]:
    if i == "
        iwa += 1
        if iwa > 1:
            ans = "No"
    else:
        iwa = 0
flag = 0
hoge = 0
if D < C:
    for i in S[B-2:D+1]:
        if i ==".":
            hoge += 1
            flag = max(flag,hoge)
        else:
            hoge = 0
    if flag < 3:
        ans = "No"
print(ans)

Solution (Python):


import itertools
from collections import Counter
from collections import defaultdict
import bisect
import math
import heapq

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

    ans = 'Yes'
    if '
        ans = 'No'

    if D < C:  
        if '...' not in S[B-2:D+1]:
            ans = 'No'

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):


import itertools
from collections import Counter
from collections import defaultdict
import bisect
import math
import heapq

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

    ans = 'Yes'
    if '
        ans = 'No'

    if ans == 'Yes':
        if c < d:
            pass
        else:
            if '...' in s[b - 2:d + 1]:
                pass
            else:
                ans = 'No'

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):


import itertools
from collections import Counter
from collections import defaultdict
import bisect
import math
import heapq

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

    blocks = 0
    for s in range(A - 1, C):
        if S[s] == '.':
            if blocks > 1:
                print('No')
                exit()
            blocks = 0
        else:
            blocks += 1

    blocks = 0
    for s in range(B - 1, D):
        if S[s] == '.':
            if blocks > 1:
                print('No')
                exit()
            blocks = 0
        else:
            blocks += 1

    if D < C:  
        can_overtake = False
        for s in range(B - 1, D):
            if S[s-1] == '.' and S[s] == '.' and S[s+1] == '.':
                can_overtake = True
                break

        if not can_overtake:
            print('No')
            exit()

    print('Yes')


if __name__ == '__main__':
    main()

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

judge = True
if "
    judge = False

if judge and c > d:
    if not "..." in s[b - 2:d + 1]:
        judge = False

print("Yes") if judge else print('No')

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

if C<D:
	if "
		print "No"
		quit()
	if "
		print "No"
		quit()
	print "Yes"
elif D<C:
	if "
		print "No"
		quit()

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

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

reachable = not ("
interupt = "..." in L[B-1:D+2]
if reachable and (C < D or interupt):
    print("Yes")
else:
    print("No")

Solution (Python):
N, A, B, C, D = map(int, input().split())
S = input()
ans = True
if D > C:
    cnt = 0
    for i in range(A-1, D):
        if cnt == 2:
            ans = False
            break
        else: 
            if S[i] == '
                cnt +=1
            else:
                cnt = 0
    if ans:
        print('Yes')
    else:
        print('No')
else:
    cnt = 0
    cnt2 = 0
    flag = False
    for i in range(A-1, C):
        if B-2<=  i <= D:
            if cnt2 == 3:
                flag = True
                if cnt == 2:
                    ans = False
                    break
                else: 
                    if S[i] == '
                        cnt +=1
                        cnt2 = 0
                    else:
                        cnt = 0
                        cnt2 += 1
            else:
                if cnt == 2:
                    ans = False
                    break
                else: 
                    if S[i] == '
                        cnt +=1
                        cnt2 = 0
                    else:
                        cnt = 0
                        cnt2 += 1
        else:
            if cnt2 == 3:
                flag = True
                cnt2 = 0
            if cnt == 2:
                ans = False
                break
            else:
                if S[i] == '
                    cnt += 1
                else:
                    cnt = 0
    if ans and flag:
        print('Yes')
    else:
        print('No')

Solution (Python):

import sys

N, A, B, C, D = map(lambda x: int(x)-1, input().split())
L = input()

reachable = True
if "
    reachable = False

if not reachable:
    print("No")
elif C < D:
    print("Yes")
else:
    if "..." in L[B-1:D+2]:
        print("Yes")
    else:
        print("No")

Solution (Python):

import sys

N, A, B, C, D = map(int, input().split())
L = list([v for v in input()])

HOP = [1, 2]
dp_d = [0]*N
dp_d[B-1] = 1
for i in range(N):
    if L[i] == "
        continue
    for h in HOP:
        dst = i+h
        if dst < N and L[dst] == ".":
            dp_d[dst] = max(dp_d[dst], dp_d[i])
dp_c = [0]*N
dp_c[A-1] = 1
for i in range(N):
    if L[i] == "
        continue
    for h in HOP:
        dst = i+h
        if dst < N and L[dst] == ".":
            dp_c[dst] = max(dp_c[dst], dp_c[i])
reachable = False
if dp_c[C-1] == 1 and dp_d[D-1] == 1:
    reachable = True

if not reachable:
    print("No")
elif C < D:
    print("Yes")
else:
    if "..." in "".join(L[B-2:min(C, D)+1]):
        print("Yes")
    else:
        print("No")

Solution (Python):
n,a,b,c,d = map(int,input().split())
S = [1] + [1 if s == "." else 0 for s in input()]
flag = True
count = 0
for s,i in zip(S[1:],range(1,n+1)):
    if not(s):
        count += 1
    else:
        count = 0
    if count == 2 and a < i and i < c:
        flag = False
        break
    elif count == 2 and b < i and i < d:
        flag = False
        break
count = 0
if  c > d:
    flag = False
    for s in S[b-1:d+2]:
        if s:
            count += 1
        else:
            count = 0
        if count == 3:
            flag = True
            break
if flag :
    print("Yes")
else:
    print("No")

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

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

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

flg1 = S[a:c+1].count("
flg2 = S[b:d+1].count("
flg3 = S[b-1:d+2].count("...")

if c < d :
    if flg1 + flg2 == 0 :
        ans = "Yes"
    else :
        ans = "No"
else :
    if (flg1 + flg2 == 0) and flg3 :
        ans = "Yes"
    else :
        ans = "No"

print(ans)

Solution (Python):
import re

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

pat1 = '
pat2 = r'\.\.\.'

ret = ''

a2c = li[a:c]
b2d = li[b:d]
if re.search(pat1, a2c) or re.search(pat1, b2d):
    ret = 'No'
else:
    if c > d:
        carea = li[b-2:d+1]
        if re.search(pat2, carea):
            ret = 'Yes'
        else:
            ret = 'No'
    else:
        ret = 'Yes'


print(ret)

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

def solveSimple(s, a, b, c, d):     
    if '
        return False 
    if '
        return False
    return True


if c < d:
    ans = solveSimple(s, a, b, c, d)
    

else:
    ans = solveSimple(s, a, b, c, d) and '...' in s[b-2:d+1]

if ans:
    print('Yes')
else:
    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:
    pattern = 1
elif c > d:
    pattern = 2
if pattern == 1:
    ans = 'Yes'
    for i in range(a, c):
        tmp = s[i:i + 2]
        if tmp == '
            ans = 'No'
            break
    for i in range(b, d):
        tmp = s[i:i + 2]
        if tmp == '
            ans = 'No'
            break
if pattern == 2:
    for i in range(b, d + 1):
        if 1 <= i + 1 <= len(s):
            tmp = s[i - 1:i + 2]
            if tmp == '...':
                ans = 'Yes'
                break
    else:
        ans = 'No'
print(ans)

Solution (Python):

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


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

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(lambda x: int(x) - 1, input().split())
s = list(input())

if c < d:
    x = a + 1
    while x < d:
        if s[x] == '
            if s[x+1] == '
                print('No')
                exit()
            else:
                x += 2
        else:
            x += 1
    print('Yes')
else:
    x = a + 1
    check = 0
    while x < c:
        if s[x] == '
            if s[x+1] == '
                print('No')
                exit()
            else:
                x += 2
        else:
            if b <= x <= d and check == 0:
                if s[x-1] == s[x] and s[x] == s[x+1]:
                    check = 1
            x += 1
    if check == 1:
        print('Yes')
    else:
        print('No')

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

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

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

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

BLOCK=[0]*N
OPEN=[0]*N

for i in range(1,N):
    if S[i]=="
        BLOCK[i]=1

for i in range(2,N):
    if S[i]==S[i-1]==S[i-2]==".":
        OPEN[i]=1

RIGHT_A=N-1
for i in range(A,N):
    if BLOCK[i]==1:
        RIGHT_A=i
        break

RIGHT_B=N-1
for i in range(B,N):
    if BLOCK[i]==1:
        RIGHT_B=i
        break

if C<=RIGHT_A+1 and D<=RIGHT_B+1:
    if C<D:
        print("Yes")
        sys.exit()
    if RIGHT_A==RIGHT_B:
        for j in range(B,D+1):
            if OPEN[j]==1:
                print("Yes")
                sys.exit()

        else:
            print("No")
                
    else:
      print("Yes")
else:
    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 (A < C < B < D) or (A < B < C < D):
    if '
        print('No')
        exit()

    if '
        print('No')
        exit()
    print('Yes')


if A < B < D < C:
    if '
        print('No')
        exit()

    if '
        print('No')
        exit()

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

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

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  n,a,b,c,d=LI()
  s=S()

  if '
    return 'No'
  if '
    return 'No'
  
  if d<c:
    
    if '...' not in s[b-2:d+1]:
      return 'No'

  return 'Yes'

print(main())

Solution (Python):
import itertools
from sys import stdin
N,A,B,C,D=[int(x) for x in stdin.readline().rstrip().split()]
S=(stdin.readline().rstrip())
lst = [0] + [1 if i == "
cumsum = itertools.accumulate(lst)
cumsum = list(cumsum) 
 
flag = True
flag_oinuki = False
for i in range(A,(len(cumsum) - 2)):
    if ((cumsum[i+2] - cumsum[i]) == 2) and A <= i <= (max(C,D)-1):
        flag = False
        break
for j in range(A,(len(cumsum) - 3)):
    if cumsum[j] == cumsum[j+3] and (B <= j + 2 <= D):
        flag_oinuki = True
 
if C > D:
    if flag_oinuki and flag:
        print("Yes")
    else:
        print("No")
else:
    if flag:
        print("Yes")
    else:
        print("No")

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

for i in range(A,max(C,D)):
    if S[i:i+2]=="
        result = "No"
        break

if result == "":
    if C < D:
        result ="Yes"
    else: 
        if S[B-2] == "." and S[B] == ".":
            result = "Yes"
        else:
            for i in range(B-2,D-2):
                if S[i:i+4] == "
                    result = "Yes"

if result == "":
    result = "No"

print(result)

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

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

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

print(result)

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

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

if result == "":
    if C < D:
        result ="Yes"
    else: 
        if S[B-2] == "." and S[B] == ".":
            result = "Yes"
        else:



            if S[B-2:D+1].count('...')>0:
                result = 'Yes'
      
if result == "":
    result = "No"

print(result)

Solution (Python):
figure=input()
math=input()
flg=False
 
figure=figure.split(' ')
if figure[3]>figure[4]:
  flg=True
  
for i in range(max(int(figure[3]),int(figure[4]))-1):
  if math[i]=='
    if i>int(figure[1]) and i<int(figure[3])-1 or i>int(figure[2]) and i<int(figure[4])-1:
    	print('No')
    	exit()
    
  if flg and i>=int(figure[2])-2 and i<int(figure[4])-1 and math[i]=='.' and math[i+1]=='.' and math[i+2]=='.':
    flg=False

if not flg:
	print('Yes')
else:
  print('No')

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")
else:
    print("Yes")

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

ans = 'Yes'
if '
    ans = 'No'

if ans == 'Yes':
    if c<d:
        pass
    else:
        if '...' in s[b-2:d+1]:
            pass
        else:
            ans = 'No'

print(ans)

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

if A < C < B < D:
    if not (S.find("
            S.find("
        print("Yes")
    else:
        print("No")
elif C < D:
    if S.find("
        print("Yes")
    else:
        print("No")
else:
    if S.find("...", B - 2) < D - 1 and S.find("...", B - 2) != -1:
        if S.find("
            print("Yes")
        else:
            print("No")
    else:
        print("No")

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

Solution (Python):
N,A,B,C,D = map(int,input().split())
S = input()
count1 = 0
count2 = 0
if C>D:
    for i in range(B-2,D+1):
        if S[i] == ".":
            count1 += 1
            if count1 ==3:
                break
        else:
            count1 = 0
    for i in range(A-1,C):
        if S[i] == '
            count2 +=1
            if count2 == 2:
                break
        else:
            count2 =0
    if count1 == 3 and count2 !=2:
        print("Yes")
    else:
        print("No")
else:
    for i in range(A-1,D):
        if S[i] == "
            count2 += 1
            if count2 == 2:
                break
        else:
            count2 = 0
    if count2 != 2:
        print("Yes")
    else:
        print("No")

Solution (Python):
ll= lambda : list(map(int,input().split()))
testcases=1

for testcase in range(testcases):
	[N,A,B,C,D]=ll()
	s=input() 
	index = [(n+1) for n, v in enumerate(s) if s[n:n+3] == "..."]
	if C < D:
	    if "
	        print("No")
	    else:
	        print("Yes")
	 
	if C > D:
	    if "
	        print("No")
	    else:
	        if len(index)>=1:
	            for i in index:
	                if B <= i+1 <= D:
	                    print("Yes")
	                    exit()
	            print("No")
	        else:
	            print("No")

Solution (Python):
n,s=open(0);n,a,b,c,d=map(int,n.split());print('YNeos'['

Solution (Python):
n,a,b,c,d=map(int,input().split());s=input();print('YNeos'['

Solution (Python):
n,a,b,c,d=map(int,input().split());s=input();t=s[b-2:d+1];print('YNeos'['

Solution (Python):
n,a,b,c,d=map(int,input().split());s=input();print('YNeos'[not'...'*(d<c)in s[b-2:d+1]or'

Solution (Python):
N,A,B,C,D = map(int, input().split())
s = input()
index = [(n+1) for n, v in enumerate(s) if s[n:n+3] == "..."]

if C < D:
    if "
        print("No")
    else:
        print("Yes")

if C > D:
    if "
        print("No")
    else:
        if len(index)>=1:
            for i in index:
                if B <= i+1 <= D:
                    print("Yes")
                    exit()
            print("No")
        else:
            print("No")

Solution (Python):
n,a,b,c,d=map(int,input().split());s=input();t=s[b-2:d+1];print('YNeos'[not'...'*(d<c)in t or'

Solution (Python):
n,a,b,c,d=map(int,input().split())
s=input()
f=0;F=0
for i in range(a,max(c,d)-1):
  if s[i:i+2]=='
for i in range(b-2,min(c,d)-1):
  if s[i:i+3]=='...':F=1
if F==0 and c>d:f=1
print('YNeos'[f::2])

Solution (Python):
n,a,b,c,d=map(int,input().split());s=input();print('YNeos'[not'...'*(d<c)in s[b-2:d+1]or'

Solution (Python):
n,a,b,c,d=map(int,input().split())
s=input()
f=0;F=0
for i in range(a,max(c,d)-1):
  if s[i]=='
for i in range(b-2,min(c,d)-1):
  if s[i]=='.' and s[i+1]=='.' and s[i+2]=='.':F=1
if F==0 and c>d:f=1
print('YNeos'[f::2])

Solution (Python):
n,a,b,c,d=map(int,input().split());s=input();print('YNeos'[not'...'in s[b-2:d+1]and d<c or'

Solution (Python):
n,a,b,c,d=map(int,input().split());s=input();print('YNeos'[1-('...'in s[b-2:d+1])and d<c or'

Solution (Python):
n,a,b,c,d = map(int, input().split())
s = input()
if s[a:c-1].count("
	print("No")
	exit()

if c > d:
	if s[b-2:d+1].count("...") == 0:
		print("No")
		exit()
print("Yes")

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

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

Solution (Python):
n,a,b,c,d=map(int,input().split());s=input();print('YNeos'['

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

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

s = input()

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()
if c < d:
    print('Yes')
else:
    for i in range(b-2, d-1):
        if s[i:i+3] == "...":
            print('Yes')
            exit()
    print('No')

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


if "
    print('No')
    exit()

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

if S[B-2] != "
    print("Yes")
    exit()
    
if S[B-2] == "
    print("Yes")
    exit()

for i in range(N):
    
    if i+B+2 >= N:
        print("No")
        exit()
    
    if i+B+2 > D:
        print("No")
        exit()
        
    if S[i+B] == "." and S[i+B+1] == "." and S[i+B+2] == ".":
        print("Yes")
        exit()

Solution (Python):
n,a,b,c,d=map(int,input().split())
s=list(input())
f=0
for i in range(b,d-1):
  if s[i]=='
    f=1
    break
for i in range(a,c-1):
  if s[i]=='
    f=1
    break
if c>d:
  F=0
  for i in range(b-2,d-1):
    if s[i]=='.' and s[i+1]=='.' and s[i+2]=='.':
      F=1
      break
  if F==0:
    f=1
if f==1:print('No')
else:print('Yes')

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 = input()
s = s + "."
cant = 0
sanrenzoku = 0
for i in range(a-1,max(c-1,d-1)):
    if s[i] == "
        if s[i+1] == "
            cant = 1

if c > d:
    for i in range(b-2,d-1):
        if s[i] == ".":
            if s[i+1] == ".":
                if s[i+2] == ".":
                   sanrenzoku = 1

if cant == 1:
    print("No")
elif c > d:
    if sanrenzoku == 0:
        print("No")
    else:
        print("Yes")
else:
    print("Yes")

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

Solution (Python):
def passable(road):
    n=len(road)
    for i in range(n-1):
        block=road[i:i+2]
        if block=='
            return False
    return True

def blank(road):
    n=len(road)
    for i in range(1,n-1):
        block=road[i-1:i+2]
        if block=='...':
            return True
    return False

def judge(A,B,C,D,S):
    if C<D:
        return passable(S[A:C+1]) and passable(S[B:D+1])
    else:
        return passable(S[A:C+1]) and passable(S[B:D+1]) and blank(S[B-1:D+2])
N,A,B,C,D=map(int,input().split())
S=input()
if judge(A-1,B-1,C-1,D-1,S):
    print('Yes')
else:
    print('No')

Solution (Python):
N, A, B, C, D = map(int,input().split())
S = input()
slist = list(S)
buf = "".join(slist[A:max(C,D)-1])
 
judge = buf.find("
 
if judge != -1:
  print("No")
else:
  if C < D:
    print("Yes")
  else:
    s_change= "".join(slist[B-2:D+1])
    judge = s_change.count("...")
    if judge > 0:
      print("Yes")
    else:
      print("No")

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

a_to_c = s[(a-1)+1:(c-1)-1 +1]

possibility = True

if c>d:
    b_to_d = s[(b-1)-1:(d-1)+1 +1]
    if "
        possibility = False
else:
    b_to_d = s[(b-1)+1:(d-1)-1 +1]
    if "
        possibility = False

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

Solution (Python):


import numpy as np





Masu = list(map(int, input().split()))
Root = input()

N = Masu[0]
A = Masu[1]
B = Masu[2]
C = Masu[3]
D = Masu[4]

S = Root

At = A-1
Bt = B-1
Ct = C-1
Dt = D-1

Judge = True






threePoints = False

if C < D:
    if "
        Judge = False
else:

    if "
        Judge = False

    if "..." in Root[Bt-1:Dt+2]:
        threePoints = True

    Judge = threePoints

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

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

Solution (Python):
n,a,b,c,d = (int(i) for i in input().split())  
s = input()
e = 0
if c<d:
  if s[a:c-1].count("
    print("Yes")
  else:
    print("No")
else:
  if s[a:c-1].count("
    print("Yes")
  else:
    print("No")

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



if C<D:
    tmp_s = 0
    for s in S[A-1:C]:
        if s == '
            clear = False
            break
        elif s == '
            tmp_s += 1
        else:
            tmp_s = 0

    tmp_s = 0
    for s in S[B-1:D]:
        if s == '
            clear = False
            break
        elif s == '
            tmp_s += 1
        else:
            tmp_s = 0

    if clear == True:
        print('Yes')
    else:
        print('No')
    


elif D<C:
    
    tmp_s = 0
    for s in S[A-1:C]:
        if s == '
            clear = False
            break
        elif s == '
            tmp_s += 1
        else:
            tmp_s = 0
    
    if clear == True:
        tmp_s = 0
        tmp_d = 0
        clear = False
        for s in S[B-2:D+1]:
            if s == '.' and tmp_d>=2 : 
                tmp_s += 1
                clear = True
            elif s == '.' and tmp_s>=0: 
                tmp_d += 1
                tmp_s = 0
            elif s == '
                tmp_s += 1
                tmp_d = 0
        if clear == True:
            print('Yes')
        else:  
            print('No')
    else:
        print('No')

Solution (Python):
import sys
sys.setrecursionlimit(100000000)
 
N, A, B, C, D = map(int, input().split())
s = list(input())
 
A -= 1
B -= 1
C -= 1
D -= 1
 
for i in range(len(s)):
    if i == len(s) - 1:
        continue
    else:
        if s[i] == '
            print("No")
            exit()
 
if D < C:
    tmp = 0
    for i in range(len(s)):
        if i == len(s) - 2 or i == len(s) - 1:
            continue
        else:
            if s[i] == '.' and s[i+1] == '.' and s[i+2] == '.' and B <= i + 1 <= D:
                tmp = 1
    if tmp != 1:
        print("No")
        exit()
 
 
 
def check(s, start, goal, ans):
    if start == goal:
        return 1
    if s[start] == '
        return 0
    if start + 1 <= N - 1:
        ans += check(s, start + 1, goal, ans)
    if start + 2 <= N - 1:
        ans += check(s, start + 2, goal, ans)
    return ans
 
ans = 0
if not check(s, B, D, ans):
    print("No")
    exit()

if not check(s, A, C, ans):
    print("No")
    exit()
print("Yes")

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 A < B < C < D:
    for i in range(A + 1, D):
        
        if S[i : i + 2] == "
            print("No")
            exit(0)
    print("Yes")
elif A < B < D < C:
    cnt3dot = 0
    for i in range(A + 1, C):
        
        if S[i : i + 2] == "
            print("No")
            exit(0)
        if (B - 1 <= i) and (i <= D - 1):
            
            if S[i : i + 3] == "...":
                cnt3dot += 1
    if cnt3dot > 0:
        print("Yes")
    else:
        print("No")
elif A < C < B < D:
    for i in range(A + 1, C):
        
        if S[i : i + 2] == "
            print("No")
            exit(0)
    for i in range(B + 1, D):
        
        if S[i : i + 2] == "
            print("No")
            exit(0)
    print("Yes")

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

if '
    flag = False
if '
    flag = False
    
if C > D:
    if '...' not in S[B-2 : D+1]:
        flag = False
    
if flag:
    print('Yes')
else:
    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 a > b:
    a, b, c, d = b, a, d, c


if '
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()[:max(c,d)]
 
def main():
    if "
        return "No"
    if "
        return "No"
 
    if c < d:
        return "Yes"
    
    else:
 
        if "..." in s[b-2:d+1]:
            return "Yes"
                
        return "No"
 
print(main())

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

Solution (Python):

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

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

Solution (Python):
import math
import numpy as np
 
 
def inputs(): return list(map(int, input().split()))
 
 
def main():
    _, A, B, C, D = inputs()
    S = input()
    maxDst = max(C, D)
    courseA = S[A-1:C]
    courseB = S[B-1:D]
    cnt = 0
    ans = []
    for i in courseB:
        if i == '
            cnt += 1
        else:
            cnt = 0
        if cnt == 2:
            ans.append(False)
            break
    else:
        ans.append(True)
    cnt = 0
    for i in courseA:
        if i == '
            cnt += 1
        else:
            cnt = 0
        if cnt == 2:
            ans.append(False)
            break
    else:
        ans.append(True)
    if D < C:
        if '...' in S[B-2: D+1]:
            ans.append(True)
        else:
            ans.append(False)

    if all(ans):
        ans = 'Yes'
    else:
        ans = 'No'
    print(ans)
 
 
if __name__ == '__main__':
    main()