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

ok = 1
for p, q in ((A, C), (B, D)):
    cnt = 0
    for i in range(p-1, q):
        if S[i] == '
            cnt += 1
        else:
            if cnt > 2:
                ok = 0
            cnt = 0
if not ok:
    print("No")
    exit(0)

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

Solution (Python):
from copy import*
n,a,b,c,d=map(int,input().split())
s=input()
if "
    print("No")
else:
    if c<d:
        print("Yes")
    else:
        if "..." in s[max(0,b-2):min(d+1,n)]:
            print("Yes")
        else:
            print("No")

Solution (Python):
n, a, b, c, d = [int(x) for x in input().split()]
s = ''.join(['
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())
a -= 1
b -= 1
s = input()
ans = "No"
snk = s[a:c].count("
fnk = s[b:d].count("
if snk == 0 and fnk == 0:
  if c > d:
    if s[b-1:d+1].count("...") >= 1:
      ans = "Yes"
  else:
    ans = "Yes"
    
print(ans)

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

Solution (Python):
N,A,B,C,D = [int(x) for x in input().split()]
S = input()
if('
    print('No')
else:
    flag = False
    if((B-A)*(D-C)<0):
        if('...'in S[max(A,B)-2:min(C,D)+1]):
            flag = True
    else:
        flag = True
    if(flag):
        print('Yes')
    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):
n, a, b, c, d = map(int, input().split())
s = input()
sac = s[a-1:c]
sbd = s[b-1:d]
ac = "
bd = "
if c < d:
    if ac and bd:
        print("Yes")
    else:
        print("No")
else:
    sbd2 = s[b-2:d+1]
    if ac and bd and "..." in sbd2:
        print("Yes")
    else:
        print("No")

Solution (Python):
def CanKenKen(List,Start,Goal):
    Q=List[Start:Goal+1]
    return all([i=="." or Q[n+1]=="." or n==Goal-Start for n,i in enumerate(Q[:-1])])
N,A,B,C,D=map(int,input().split())
A,B,C,D=map(lambda x:x-1 ,[A,B,C,D])
S=input()

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

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

S0 = S[:A]
Sa = S[A-1:C]
Sb = S[B-2:D+1]
F = max(C,D)
S1 = S[F:]











if Sa.find('
    ans = "No"

if A<B<D<C and not '...' in Sb:
    ans = "No"

print(ans)

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

def no2rock(l, r):
    global s
    for i in range(l + 1, r + 1):
        if s[i - 1] == "
            return False
    return True

def rest(l, r):
    global s
    for i in range(l, r + 1):
        if s[i - 1] == "." and s[i] == "." and s[i + 1] == ".":
            return True
    return False

if c < d:
    if no2rock(a, c) and no2rock(b, d):
        print("Yes")
    else:
        print("No")
else:
    if no2rock(a, c) and no2rock(b, d) and rest(b, d):
        print("Yes")
    else:
        print("No")

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

Solution (Python):
n, a, b, c, d = map(int, input().split())
s = input()
rock = 0
brank = 0
rfrag = 0
bfrag = 0
mrock = 0
mbrank = 0
rlist = []
blist = []
for i in range(n):
    if s[i] == "
        if bfrag == 1:
            if brank >= 3:
                blist.append(i-brank+1)
            if mbrank < brank:
                mbrank = brank
                brank = 0
            brank = 0
        rock += 1
        rfrag = 1
    if s[i] == ".":
        if rfrag == 1:
            if rock >= 2:
                rlist.append(i-rock+1)
            if mrock < rock:
                mrock = rock
                rock = 0
            rock = 0
        brank += 1
        bfrag = 1
if mrock < mbrank:
    if brank >= 3:
        blist.append(n-brank+1)
    if mbrank < brank:
        mbrank = brank
        brank = 0    
else:
    if mrock < rock:
        mrock = rock
        rock = 0

p = 0
for i in range(len(rlist)):
    if a < rlist[i] < c or b <  rlist[i] < d:
        print("No")
        p = 1
        break

y = 0 
if d < c and p == 0:
    x = 0
    for i in range(len(blist)):
        if b-1 <= blist[i] < d:
            x = 1            
    if x == 1:
        print("Yes")
        y = 1
    elif x == 0:
        print("No")
        y = 1
        
if p == 0 and y == 0:
    print("Yes")

Solution (Python):

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

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

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

Solution (Python):
def check(X, Y, N, S):
    overtake = False
    while X <= Y:
        if S[X-2] == "." and S[X] == ".":
            overtake = True
        if X == Y:
            break
        if S[X] == ".":
            X += 1
        else:
            if X+1 <= N and S[X+1] == ".":
                X += 2
            else:
                return False, False
    return True, overtake

def main():
    N, A, B, C, D = map(int, input().split())
    S = input()
    S += "
    A_ok, _ = check(A, C, N, S)
    B_ok, overtake = check(B, D, N, S)
    if A_ok and B_ok and (C < D or overtake):
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()

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

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

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

Solution (Python):
n, a, b, c, d = [int(i) for i in input().split()]
s = input()
res = "Yes"
e = max(c,d)
if "
	res = "No"
elif c > d:
	if "..." not in s[b-2:d+1]:
		res = "No"
print(res)

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

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

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

Solution (Python):

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



ans = (
    'Yes' if ('
        C < D or
        '...' in S[(B - 2):(D + 1)]
    ) else
    'No'
)


print(ans)

Solution (Python):

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



ans = (
    'Yes' if ('
        C < D or
        '...' in S[(B - 2):(D + 1)]
    ) else
    'No'
)


print(ans)

Solution (Python):
n, a, b, c, d = [int(i) for i in input().split()]
S = ' ' + input()

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

Solution (Python):
n,a,b,c,d=map(int,input().split())
s=str(input())
s=s.replace('.','0')
s=s.replace('
x=0
y=0
f=0
g=0
for i in range(c-a-1):
    x=int(s[i+a])
    y=int(s[i+a+1])
    if(x*y==1):
        f=-1
for j in range(d-b-1):
    x=int(s[j+b])
    y=int(s[j+b+1])
    if(x*y==1):
        g=-1
if(d<c):
    if(s[b-2:d+1].find('000')==-1):
        f=-1
if(f==0 and g==0):
    print('Yes')
else:
    print('No')

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

if "
  print("No")
elif c<d:
  print("Yes")
elif "..." 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:
    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()

flag = True


if "
    flag = False


if C > D and flag:
    flag = False
    if "..." in S[B-2:D+1]:
        flag = True

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

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

index1 = s[a:c].find("
index2 = s[b:d].find("

ans = "No"

if index1 == -1 and index2 == -1:
  if c < d :
    ans = "Yes"
  elif s[max(b-1,0):d+1].find("...") != -1 :
    ans = "Yes"
  
print(ans)

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

index1 = s[a:c].find("
index2 = s[b:d].find("

ans = "No"

if index1 == -1 and index2 == -1:
  if c < d :
    ans = "Yes"
  elif s[b-1:d+1].find("...") != -1 :
    ans = "Yes"
  
print(ans)

Solution (Python):

def check_two_stones(S, A, B, C, D):
    for i in range(B, D):
        if S[i] is "
            return False
    for i in range(A, C):
        if S[i] is "
            return False

    return True

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

S = S_org + "
if (B < C and C < D) or (C < B and B < D):
    if check_two_stones(S, A, B, C, D) is False:
        print("No")
        exit()
else:
    check = True
    for i in range(B, D):
        if S[i] is "
            check = False

    
    
         

    S = S_org + "
    for j in range(B-2, D-1):
        if S[j] is "." and S[j+1] is "." and S[j+2] is ".":
            check = True
            break
        else:
            check = False

    if check is False:
        print("No")
        exit()

    S = S_org + "
    for i in range(A, C):
        if S[i] is "
            print("No")
            exit()

print("Yes")

Solution (Python):

def can_reach( S, 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 = "


if can_reach(S, A, C) == False or can_reach(S, B, D) == False:
    print("No")
    exit()

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 snuke_can_over is False:
        print("No")
        exit()

print("Yes")

Solution (Python):
def hantei(n, a, b, c, d, s):
    if s[a - 1:c].find("
        return "No"
    if s[b - 1:d].find("
        return "No"
    if c > d:
        if s[max(0, b - 2):min(n, d + 1)].find("...") == -1:
            return "No"
    return "Yes"

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

Solution (Python):
import sys
import numpy as np


def main():
    n, a, b, c, d = [int(x) for x in input().split()]
    nv = np.insert(np.array([1 if char == '
    nv1 = nv[1:] + nv[:-1]
    nv2 = nv[2:] + nv[1:-1] + nv[:-2]
    if np.any(nv1[a:max(c, d)] == 2):
        print("No")
    elif c < d:
        print("Yes")
    elif np.any(nv2[b-1:d] == 0):
        print("Yes")
    else:
        print("No")


main()

Solution (Python):
import sys
import numpy as np


def main():
    n, a, b, c, d = [int(x) for x in input().split()]
    a -= 1
    b -= 1
    c -= 1
    d -= 1
    nv = np.insert(np.array([1 if char == '
    for i in range(a, max(c, d)):
        if nv[i + 2] - nv[i] == 2:
            print("No")
            sys.exit()
    if c < d:
        print("Yes")
        sys.exit()
    for i in range(b, d + 1):
        if nv[i + 2] - nv[i - 1] == 0:
            print("Yes")
            sys.exit()
    print("No")


main()

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

e = 'Yes'
f = 0
g = 1

if c < d:
    for i in range(b-1,d-1):
        if s[i]=='
            e ='No'
    if e =='Yes':
        for j in range(a-1,b-1):
            if s[j]=='
                e ='No'
                        
if c > d:
    for i in range(a-1,c-1):
        if s[i]=='
            f = 1
    
    for j in range(b-2,d-1):
        if s[j]=='.' and s[j+1]=='.' and s[j+2]=='.':
            g = 0

    if g == 0 and f ==0:
        e ='Yes'
    else:
        e ='No'
            
print(e)

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

def check1(l,r):
    if S[l:r+1].count("
        return False
    return True

def check2():
    if S[B-1:D+2].count("...") > 0:
        return True
    return False

if C < D:
    if check1(A,C) and check1(B,D):
        ans = "Yes"
    else:
        ans = "No"
elif D < C:
    if check1(B,D) and check2():
        ans = "Yes"
    else:
        ans = "No"
else:
    ans = "No"

print(ans)

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

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

    if '
        return False
    if '
        return False
    if c > d:
        if '...' not in s[b-1:d+1]:
            return False
    return True

print(['No', 'Yes'][f()])

Solution (Python):
n,a,b,c,d = map(int,input().split())
s = input()
if c < d:
    s1 = s[a:c]
    s2 = s[b:d]
    if "
        print("No")
    else:
        print("Yes")
else:
    s3 = s[b-2:d+1]
    s4 = s[a:c]
    if "..." in s3:
        if "
            print("No")
        else:
            print("Yes")
    else:
        print("No")

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

string = input()

if "
    print("No")

elif c < d:
    print("Yes")

else :
    if "..." in string[b-2:d+1]:
        print("Yes")

    else :
        print("No")

Solution (Python):

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

flag = 0

Rock = 0
for i in range(D-B+1):
    I = B-1+i
    if Slist[I] == "
        Rock+=1
        if Rock == 2:
            flag = 1
            break
    else:
        Rock = 0
Rock = 0
for i in range(C-A+1):
        I = A-1+i
        if Slist[I] == "
            Rock+=1
            if Rock == 2:
                flag = 1
                break
        else:
            Rock = 0

if C > D:
    white = 0
    wflag = 0
    for i in range(D-B+3):
        I = B-2+i
        if Slist[I] == ".":
            white+=1
            if white >= 3:
                wflag = 1
                break
        else:
            white = 0
    if white >= 3:
        wflag = 1
        
    if wflag == 0:
        flag = 1
        
if flag == 1:
    print("No")
else:
    print("Yes")

Solution (Python):
N,A,B,C,D=map(int,input().split())
S=input()
c=0
if '
    c=1
if C<D:
    if c==0:
        print("Yes")
    else:
        print("No")

elif C>D:
    if '...' in S[B-2:D+1] and c==0:
        print('Yes')
    else:
        print('No')

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

Solution (Python):
n, a, b, c, d = map(int, input().split())
s = input()
if '
    print('No')
elif 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()
if '
    print('No')
elif 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()

flag = False

if c < d:
  if s[a-1:c].count('
    flag = True
else:
  if s[a-1:c].count('
    flag = True

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

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

Solution (Python):
l = input().split()
N = int(l[0])
A = int(l[1])
B = int(l[2])
C = int(l[3])
D = int(l[4])
l = input().split()
S = l[0]



def blocked(path):
    return '

def cleared(path):
    return '...' in path

def find_path(A, B, C, D, S):
    s_path = S[A:C]
    f_path = S[B:D]
    if blocked(s_path) or blocked(f_path):
        return False
    return True

def solve(A, B, C, D, S):
    if not find_path(A, B, C, D, S):
        return False
    begin = B - 2
    end = D - 2 if S[D - 2] == '
    return cleared(S[begin:end])

ret = True
if C < D:
    ret = find_path(A, B, C, D, S)
else:
    ret = solve(A, B, C, D, S)

if ret:
    print('Yes')
else:
    print('No')

Solution (Python):
l = input().split()
N = int(l[0])
A = int(l[1])
B = int(l[2])
C = int(l[3])
D = int(l[4])
l = input().split()
S = l[0]



def blocked(path):
    return '

def find_path(A, B, C, D, S):
    s_path = S[A:C]
    f_path = S[B:D]
    if blocked(s_path) or blocked(f_path):
        return False
    return True

def solve(A, B, C, D, S):
    if not find_path(A, B, C, D, S):
        return False
    begin = B - 2
    if S[D - 2] == '
        if '...' in S[begin:D - 2]:
            return True
        else:
            return False
    else:
        path = S[begin:C]
        if '...' in path:
            return True
    return False

ret = True
if C < D:
    ret = find_path(A, B, C, D, S)
else:
    ret = solve(A, B, C, D, S)

if ret:
    print('Yes')
else:
    print('No')

Solution (Python):
def a_kenken_race(N, A, B, C, D, S):
    
    
    cond1 = '
    cond2 = '...' not in S[B - 2:D + 1]

    if cond1:
        ans = 'No'
    elif C > D and cond2:
        ans = 'No'
    else:
        ans = 'Yes'  
    return ans

N, A, B, C, D = [int(i) for i in input().split()]
S = input()
print(a_kenken_race(N, A, B, C, D, S))

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

for i in range(A+1,C+1):
    if S[i]=="
        print("No")
        exit()
for i in range(B+1,D+1):
    if S[i]=="
        print("No")
        exit()
F=0
if D<C:
    F=1
    for i in range(B-1,D):
        if S[i]=="." and S[i+1]=="." and S[i+2]==".":
            F=0
            break
if F==1:
    print("No")
    exit()
print("Yes")

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

    answer = "-1"

    if C < D:
       if S[A:D:].count("
           answer = "No"
       else:
           answer = "Yes"
    else:

        answer = "No"
        for x in range(B, D+1):
            if (S[x-2] == "." and S[x-1] == "." and S[x] == "."):
               answer = "Yes"

    print(answer)

Solution (Python):



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

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

    if (c > d) and ('...' not in s[b - 2: d + 1]):
        print('No')
        exit()

    print('Yes')


if __name__ == '__main__':
    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()

flag = True
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):
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
 

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

flag = True
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):

import sys
def input(): return sys.stdin.readline().rstrip()
def mi(): return map(int, input().split())


N, A, B, C, D = mi()

cells = input()


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

ans = '?'

goal = max(C,D)


rockcheck = 0 
for i, cell in enumerate(cells):
  if i < A or goal < i: continue
  if rockcheck == 1 and cell == '
    ans = 'No'
    break
  elif cell == '
  else: rockcheck = 0


if C < D: flag = 0
else: flag = 1

if ans == 'No':
  print('No')
  exit()
elif flag == 0: 
  print('Yes')
  exit()


ans = 'No'


blankcheck = 0 
for i, cell in enumerate(cells):
  if i < (B-1) or (D+1) < i: continue
  if cell == '.': blankcheck += 1
  else: blankcheck = 0
  if blankcheck == 3:
    ans = 'Yes'
    break

print(ans)

Solution (Python):
n,a,b,c,d=map(int,input().split())
s=input()
def f(x,y):
  return "
if c<d:
  print("Yes" if f(a,c) and f(b,d) else "No")
else:
  if f(a,c)==False or f(b,d)==False:
    print("No")
  else:
    if "..." in s[b-2:d+1]:
      ans=True
    else:
      ans=False
    print("Yes" if ans==True else "No")

Solution (Python):

"""
A - Kenken Race
https://atcoder.jp/contests/agc034/tasks/agc034_a

"""
import sys


def solve(N, A, B, C, D, S):
    p_A = set([A])
    for p, n1, n2 in zip(range(A, C), S[A+1:], S[A+2:]):
        if p in p_A:
            if n1 == '.' and p+1 <= C:
                p_A.add(p+1)
            if n2 == '.' and p+2 <= C:
                p_A.add(p+2)

    p_B = set([B])
    for p, n1, n2 in zip(range(B, D), S[B+1:], S[B+2:]):
        if p in p_B:
            if n1 == '.' and p+1 <= D:
                p_B.add(p+1)
            if n2 == '.' and p+2 <= D:
                p_B.add(p+2)

    p_t = set()
    for p, p1, p2, p3 in zip(range(B, N+1), S[B-1:D], S[B:D+1], S[B+1:]):
        if p1 == '.' and p2 == '.' and p3 == '.' and p <= D:
            p_t.add(p)

    if C < D:
        if C in p_A and D in p_B:
            return 'Yes'
        return 'No'
    else:
        if (C in p_A) and (D in p_B) and (p_B & p_t):
            return 'Yes'
        return 'No'


def main(args):
    N, A, B, C, D = map(int, input().split())
    S = input()
    S = '
    ans = solve(N, A, B, C, D, S)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Solution (Python):

import numpy as np
import sys

  
N,A,B,C,D = map(int,raw_input().split())
originalS = raw_input()
S = originalS
S = S[:A-1]+'A'+S[A:]
S = S[:B-1]+'B'+S[B:]

S = list(S)
boolean = False

if A<B:
  while S[D-1] != 'B':
    if S[B]  == '.':
      if S[B-2] == '.':
        while S[C-1] != 'A':
          if S[A] != '.':
            if S[A+1] == '.':
              S[A-1] = originalS[A-1]
              A += 1
            else:
              print 'No'
              sys.exit()
          S[A] = 'A'
          S[A-1] = originalS[A-1]
          A += 1
        boolean = True
    else:
      if S[B+1] == '.':
        S[B-1] = originalS[B-1]
        B  += 1
      else:
        print 'No'
        sys.exit()

    S[B] = 'B'
    S[B-1] = originalS[B-1]
    B += 1

  if boolean == False:
    while S[C-1] != 'A':
          if S[A] != '.':
            if S[A+1] == '.':
              S[A-1] = originalS[A-1]
              A += 1
            else:
              print 'No'
              sys.exit()
          S[A] = 'A'
          S[A-1] = originalS[A-1]
          A += 1
  print 'Yes'
  sys.exit()

else:
  while S[C-1] != 'A':
    if S[A]  == '.':
      if S[A-2] == '.':
        while S[D-1] != 'B':
          if S[B] != '.':
            if S[B+1] == '.':
              S[B-1] = originalS[B-1]
              B += 1
            else:
              print 'No'
              sys.exit()
          S[B] = 'B'
          S[B-1] = originalS[B-1]
          B += 1
        boolean = True
    else:
      if S[A+1] == '.':
        S[A-1] = originalS[A-1]
        A  += 1
      else:
        print 'No'
        sys.exit()

    S[A] = 'A'
    S[A-1] = originalS[A-1]
    A += 1

  if boolean == False:
    while S[D-1] != 'B':
      if S[B] != '.':
        if S[B+1] == '.':
          S[B-1] = originalS[B-1]
          B += 1
        else:
          print 'No'
          sys.exit()
      S[B] = 'B'
      S[B-1] = originalS[B-1]
      B += 1

  print 'Yes'
  sys.exit()

Solution (Python):
N, A, B, C, D = [int(i) - 1 for i in input().strip().split(' ')]
N += 1
S = [c for c in input().strip()]
S += '


def check(current, dest):
  i = current + 1
  while True:
    if i >= dest:
      return True
    elif S[i] == '.':
      i = i + 1
    elif S[i + 1] == '.':
      i = i + 2
    else:
      return False


def passable():
  i = B
  while True:
    if i > D:
      return False
    elif S[i - 1] == '.' and S[i] == '.' and S[i + 1] == '.':
      return True
    else:
      i = i + 1


def main():
  if D > C:
    return check(B, D) and check(A, C)
  else:
    return passable() and check(A, C)


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

Solution (Python):
import re                                                                                                        
import copy                                                                                                      

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

def solve(r,l):
    for i in range(r,l-1):
        if s[i-1] == "
            return False
    return True

def perfect_solve(r,l):
    for i in range(r,l-1):
        if s[i-1] =="
            return False

    for i in range(r-1,l):
        if s[i-1]=="." and s[i]=="." and s[i+1]==".":
            return True
    return False

if C < B :
    if solve(A,C) and solve(B,D):
        print("Yes")
    else:
        print("No")
elif C < D :
    if solve(B,D) and solve(A,B):
        print("Yes")
    else:
        print("No")
else:
    if perfect_solve(B,D) and solve(A,B) and solve(D,C):
        print("Yes")
    else:
        print("No")

Solution (Python):

import sys

YES = "Yes"  
NO = "No"  

def solve(N: int, A: int, B: int, C: int, D: int, S: str):

    if(S[A-1:C+1].count('
    
        print(NO)
        sys.exit()

    if(D < C):
        if(S[B-2:D+1].count('...') <= 0):
            print(NO)
            sys.exit()
        else:
            print(YES)
    else:
        print(YES)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    A = int(next(tokens))  
    B = int(next(tokens))  
    C = int(next(tokens))  
    D = int(next(tokens))  
    S = next(tokens)  
    solve(N, A, B, C, D, S)

if __name__ == '__main__':
    main()

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

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

else:
    print("Yes")