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())
A -= 1
B -= 1
C -= 1
D -= 1
s = str(input())
if C < D:
    if "
        print("No")
    else:
        print("Yes")
else:
    if "
        print("No")
    else:
        if D-B >= 2:
            if "..." in s[B-1:D+1]:
                print("Yes")
            elif s[D-1] == ".":
                print("Yes")
            else:
                print("No")
        else:
            if s[B+2] == "." or s[B-1] == ".":
                print("Yes")
            else:
                print("No")

Solution (Python):
n,a,b,c,d=map(int,input().split())
s=input()
s2=s[min(a,b)-1:max(c,d)]
n2=len(s2)

sl=s[a-1:c]
sr=s[b-1:d]

for i in range(len(sl)-1):
    if sl[i]=="
        print("No")
        import sys
        sys.exit()
for i in range(len(sr)-1):
    if sr[i]=="
        print("No")
        import sys
        sys.exit()


if c<d:
    print("Yes")
else:
    for i in range(n2-2):
        if s2[i]=="." and s2[i+1]=="." and s2[i+2]=="." and i<d-1 and b<i+3:
            print("Yes")
            import sys
            sys.exit()
    print("No")

Solution (Python):
import copy
n,a,b,c,d=map(int, input().split())
S='.'+input()
dpa=[0]*(n+1)
dpb=[0]*(n+1)
seta=[c]
setb=[d]
if d<c:
    if S[b-1:d+2].find('...')>=0:
        while seta:
            i = seta.pop()
            if i>0 and S[i-1]=='.' and dpa[i-1]==0:
                dpa[i-1]=1
                seta.append(i-1)
            if i>1 and S[i-2]=='.' and dpa[i-2]==0:
                dpa[i-2]=1
                seta.append(i-2)
        while setb:
            i = setb.pop()
            if i>0 and S[i-1]=='.' and dpb[i-1]==0:
                dpb[i-1]=1
                setb.append(i-1)
            if i>1 and S[i-2]=='.' and dpb[i-2]==0:
                dpb[i-2]=1
                setb.append(i-2)
else:
    while setb:
        i = setb.pop()
        if i>0 and S[i-1]=='.' and dpb[i-1]==0:
            dpb[i-1]=1
            setb.append(i-1)
        if i>1 and S[i-2]=='.' and dpb[i-2]==0:
            dpb[i-2]=1
            setb.append(i-2)
    while seta:
        i = seta.pop()
        if i>0 and S[i-1]=='.' and dpa[i-1]==0:
            dpa[i-1]=1
            seta.append(i-1)
        if i>1 and S[i-2]=='.' and dpa[i-2]==0:
            dpa[i-2]=1
            seta.append(i-2)
if dpa[a]==1 and dpb[b]==1:
    print('Yes')
else:
    print('No')

Solution (Python):
import sys

def PNO():
    print("No")
    sys.exit(0)

def PYES():
    print("Yes")
    sys.exit(0)



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

ac = str(s[a:c])


if (ac.find("
    PNO()

bd = str(s[b:d])


if (bd.find("
    PNO()

if (c > d):
    bdd = str(s[b-1:d+2])
    
    
    if (bdd.find("...") == -1):
        PNO()

PYES()

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

S[A-1] = 'A'
S[B-1] = 'B'

        
if B < C:
    while(B < D):
        if S[B] == '.' and S[B-2] == '.':
            while(A < C):
                
                if S[A] == '.':
                    S[A] = 'A'
                    S[A-1] = '.'
                else:
                    
                    if A+1 < N and S[A+1] == '.':
                        S[A+1] = 'A'
                        S[A-1] = '.'
                        A += 1
                    else:
                        break
                A += 1
        
                
        
        if S[B] == '.':
            S[B] = 'B'
            S[B-1] = '.'
        else:
            if S[B+1] == '.' and B+1 < N:
                S[B+1] = 'B'
                S[B-1] = '.'
                B += 1
            else:
                break
        
        B += 1
        
        
    
    
    while(A < C):
        
        if S[A] == '.':
            S[A] = 'A'
            S[A-1] = '.'
        else:
            
            if A+1 < N and S[A+1] == '.':
                S[A+1] = 'A'
                S[A-1] = '.'
                A += 1
            else:
                break
        A += 1
        
        
        
elif B > C:
    while(A < C):
        if S[A] == '.' and S[A-2] == '.':
            while(B < D):
                
                if S[B] == '.':
                    S[B] = 'B'
                    S[B-1] = '.'
                else:
                    
                    if B+1 < N and S[B+1] == '.':
                        S[B+1] = 'B'
                        S[B-1] = '.'
                        B += 1
                    else:
                        break
                B += 1
        
                
        
        if S[A] == '.':
            S[A] = 'A'
            S[A-1] = '.'
        else:
            if S[A+1] == '.' and A+1 < N:
                S[A+1] = 'A'
                S[A-1] = '.'
                A += 1
            else:
                break
        
        A += 1
        
        
    
    
    while(B < D):
        
        if S[B] == '.':
            S[B] = 'B'
            S[B-1] = '.'
        else:
            
            if B+1 < N and S[B+1] == '.':
                S[B+1] = 'B'
                S[B-1] = '.'
                B += 1
            else:
                break
        B += 1
        
        
    
    
        
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 c<d:
    if '
        print('No')
    else:
        print('Yes')
elif d<c:
    if '
        print('No')
    else:
        if '...' in s[b-2:d+1]:
            print('Yes')
        else:
            print('No')

Solution (Python):
import numpy as np
import math
import sys

def is_dubble_wall(min_, max_, S):
    for i in range(min_, max_):
        if (S[i] == "
            return True
    return False

def main():
    N, A, B, C, D = map(int, input().split())
    S = "
    S += input()
    assert(len(S) == N + 1)
    if (B < C):
        if is_dubble_wall(min(A, B), max(C, D), S):
            print("No")
            sys.exit()
        if (D < C):
            
            num = 0
            array = []
            for i in range(B - 1, D + 2):
                if S[i] == ".":
                    num += 1
                else:
                    array.append(num)
                    num = 0
            array.append(num)
            if max(array) >= 3:
                print("Yes")
            else:
                print("No")
        else:
            
            print("Yes")
    else:
        if (~is_dubble_wall(A, C, S) and ~is_dubble_wall(B, D, S)):
            print("Yes")
        else:
            print("No")

if __name__ == '__main__':
    main()

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







S = "
N = N+2

M = max(C,D)

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

pos = B
while(True):
	if pos == D:
		if S[pos+1] == "
			print("No")
			exit()
		else:
			print("Yes")
			exit()
	if pos == D-1:
		if S[pos+2] == "
			print("No")
			exit()
		else:
			print("Yes")
			exit()
	loc = S[pos+1:pos+3]
	if loc == "..":
		print('Yes')
		exit()
	if loc == "
		pos += 2
	if loc == ".
		if S[pos-1] == ".":
			print('Yes')
			exit()
		pos += 3

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

if S[A-1:max([C, D])].find('
    print('No')
    exit()

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

if S[B-2:D+1].find('...') >= 0:
    print('Yes')
else:
    print('No')

Solution (Python):
if __name__ == '__main__':
    split = input().split(' ')
    n = int(split[0]) - 1
    a = int(split[1]) - 1
    b = int(split[2]) - 1
    c = int(split[3]) - 1
    d = int(split[4]) - 1
    s = input()
    isOK = False
    if c < d:
        isOK = not ('
    else:
        isOK = (not ('
    print('Yes' if isOK else 'No')

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

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

Solution (Python):
from copy import deepcopy

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


def start_funuke():
    s = deepcopy(S)
    funuke = s[B - 1 : D]
    for i in range(1, len(funuke)):
        if funuke[i] == "
            return False
    s[D - 1] = "
    sunuke = s[A - 1 : C]
    for i in range(1, len(sunuke)):
        if sunuke[i] == "
            return False
    return True


def start_sunuke():
    s = deepcopy(S)
    funuke = s[B - 1 : D]
    f = True
    for i in range(2, len(funuke)):
        if (funuke[i] == "." and funuke[i - 1] == "." and funuke[i - 2] == ".") and (
            i - 1 != C - 1
        ):
            f = False
    s[B - 1] = "%"
    sunuke = s[A - 1 : C]
    for i in range(2, len(sunuke)):
        if sunuke[i] == "." and sunuke[i - 1] == "%" and sunuke[i - 2] == ".":
            f = False
    if f:
        return False
    s = deepcopy(S)
    sunuke = s[A - 1 : C]
    for i in range(1, len(sunuke)):
        if sunuke[i] == "
            return False
    s[C - 1] = "
    funuke = s[B - 1 : D]
    for i in range(1, len(funuke)):
        if funuke[i] == "
            return False
    return True


f1 = start_funuke()
f2 = start_sunuke()
if f1 or f2:
    print("Yes")
else:
    print("No")

Solution (Python):
N, A, B, C, D = map(int, input().split())
S = list(input())
S[A - 1] = 'A'
S[B - 1] = 'B'
a1 = 0
a2 = 0
ans = ''
if C > D:
    a1 = 'A'
    a2 = 'B'
    tmp1 = C - 1
    tmp2 = D - 1
    now1 = A - 1
    now2 = B - 1
else:
    a1 = 'B'
    a2 = 'A'
    tmp1 = D - 1
    tmp2 = C - 1
    now1 = B - 1
    now2 = A - 1

while True:
    if now1 != tmp1:
        if now1 + 1 <= len(S) - 1 and S[now1 + 1] == '.' and now1 + 1 <= tmp1:
            S[now1] = '.'
            S[now1 + 1] = a1
            now1 += 1
        elif now1 + 2 <= len(S) - 1 and S[now1 + 2] == '.' and now1 + 2 <= tmp1:
            S[now1] = '.'
            S[now1 + 2] = a1
            now1 += 2
        elif now2 + 1 <= len(S) - 1 and S[now2 + 1] == '.' and now2 + 1 <= tmp2:
            S[now2] = '.'
            S[now2 + 1] = a2
            now2 += 1
        elif now2 + 2 <= len(S) - 1 and S[now2 + 2] == '.' and now2 + 2 <= tmp2:
            S[now2] = '.'
            S[now2 + 2] = a2
            now2 += 2
        else:
            ans = 'No'
            break
    elif now2 != tmp2:
        if now2 + 1 <= len(S) - 1 and S[now2 + 1] == '.' and now2 + 1 <= tmp2:
            S[now2] = '.'
            S[now2 + 1] = a2
            now2 += 1
        elif now2 + 2 <= len(S) - 1 and S[now2 + 2] == '.' and now2 + 2 <= tmp2:
            S[now2] = '.'
            S[now2 + 2] = a2
            now2 += 2
        else:
            ans = 'No'
            break
    else:
        ans = 'Yes'
        break

print(ans)

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

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

Solution (Python):
from collections import defaultdict


def inpl():
    return list(map(int, input().split()))


N, A, B, C, D = inpl()
S = "
section = [-1 for i in range(N + 2)]
ischange = defaultdict(lambda: False)
interval = defaultdict(lambda: [-1, -1])
sec_num = 0

flag = True
for i, s in enumerate(zip(S, S[1:])):
    if s == ("
        sec_num += 1
        section[i] = -1
        section[i + 1] = -1
        flag = True
    else:
        section[i] = sec_num
        section[i + 1] = sec_num
        if flag is True:
            interval[sec_num][0] = sec_num
            flag = False
        else:
            interval[sec_num][1] = sec_num + 1
    if B - 1 <= i < D and i < N and S[i] + S[i + 1] + S[i + 2] == "...":
        ischange[sec_num] = True

if section[A] != section[C] or section[B] != section[D]:
    print("No")
elif section[A] != section[B]:
    print("Yes")
elif C < D:
    print("Yes")
elif ischange[section[A]] is True:
    print("Yes")
else:
    print("No")

Solution (Python):

import sys
INF = float("inf")


def yes():
    print("Yes")  


def no():
    print("No")  


def f(A, B, C, D, S):
    T = list(S)
    T[A] = "A"
    T[B] = "B"
    T[C] = "C"
    T[D] = "D"
    print("".join(T))


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

    def reachable(A, C, S):     
        if A > C:
            return False
        
        if S[A:C+1].find("
            return True
        else:
            return False

    if C > D:
        
        
        oikoshi = S[B-1:].find("...")
        if oikoshi == -1:
            no()
            return
        if reachable(A, B-1+oikoshi, S) and reachable(B, B-1+oikoshi+1, S):
            A = B-1+oikoshi + 2
            B = B-1+oikoshi + 1
            
        else:
            no()
            return

    
    if reachable(A, C, S) and reachable(B, D, S):
        yes()
    else:
        no()
    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):
import sys

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

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

s[a] = "A"
s[b] = "B"


if c < d:
    while s[c] != "A" or s[d] != "B":
        if s[d] != "B":
            if s[b+1] == ".":
                s[b+1] = "B"
                s[b] = "."
                b += 1
                continue
            elif s[b+2] == ".":
                s[b+2] = "B"
                s[b] = "."
                b += 2
                continue
        if s[c] != "A":
            if s[a+1] == ".":
                s[a+1] = "A"
                s[a] = "."
                a += 1
                continue
            elif s[a+2] == ".":
                s[a+2] = "A"
                s[a] = "."
                a += 2
                continue
        print("No")
        sys.exit()
if d < c:
    while s[c] != "A" or s[d] != "B":
        if s[c] != "A":
            if s[a+1] == ".":
                s[a+1] = "A"
                s[a] = "."
                a += 1
                continue
            elif s[a+2] == ".":
                s[a+2] = "A"
                s[a] = "."
                a += 2
                continue
        if s[d] != "B":
            if s[b+1] == ".":
                s[b+1] = "B"
                s[b] = "."
                b += 1
                continue
            elif s[b+2] == ".":
                s[b+2] = "B"
                s[b] = "."
                b += 2
                continue
        print("No")
        sys.exit()

print("Yes")

Solution (Python):

N,A,B,C,D = map(int,input().split())
a= input()
f = 0
s = 0
d = 1
t = []
k = []

f1 = 0
s1 = 0
d1 = 1
t1 = []
k1 = []


for i in a[A-1:C]:
    if i == "." and f ==1:
        k.append(d)
        s = 1
        f = 0
    elif i == ".":s+=1
    
    elif i == "
        t.append(s)
        d = 1
        f = 1
    elif i == "
else:
    if f==1:
        k.append(d)
    else:
        t.append(s)
for i in a[B-2:D]:
    if i == "." and f1 ==1:
        k1.append(d1)
        s1 = 1
        f1 = 0
    elif i == ".":s1+=1
    
    elif i == "
        t1.append(s1)
        d1 = 1
        f1 = 1
    elif i == "
else:
    if f1==1:
        k1.append(d1)
    else:
        t1.append(s1)


if C < D :
    if len(k) == sum(k) and  len(k1) == sum(k1):
        print("Yes")
    else:
        print("No")
else:
    if len(k) == sum(k) and any([i > 2 for i in t1]) :
        print("Yes")
    elif len(k) == sum(k) and t1[-1] >1:
        print("Yes")
    else:
        print("No")

Solution (Python):
n,a,b,c,d=map(int,input().split())
s=list(input())
s[c-1]="c"
s[d-1]="d"
flag=False
lim=max(c,d)
for i in range(a+1,lim-1):
  if s[i]!="
    if b-1<=i and i<=d-1:
      if s[i-1]!="
        flag=True
    continue
  if s[i+1]=="
    print("No")
    exit()
if flag==False and d<c and (s[d-2]=="
    print("No")
    exit()
print("Yes")

Solution (Python):
from heapq import heappush, heappop
import re
from collections import deque
import sys
input = sys.stdin.readline


def int_raw():
    return int(input())


def ss_raw():
    return input().split()


def ints_raw():
    return tuple(map(int, ss_raw()))


DIV = 10**9+7


def mod_invs(n, mod=DIV):
    inv = [0]*(n+1)
    inv[0] = 1
    inv[1] = 1
    for i in range(2, n+1):
        inv[i] = (-(mod//i)*inv[mod % i]) % mod
    return inv


N,A,B,C,D = ints_raw()
S = input()



def main():
    ans = 0
    if D==C:
        return "No"
    if S[D-1]=="
        return "No"
    if "
        return "No"
    if D>C:
        return "Yes"
    else:
        if "..." in S[B-2:min(min(D+1,N),C)]:
            
            return "Yes"
        return "No" 
    return ans


print(main())

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

s = input() + '.'

def solve():
    if C < D:
        cnt = 0
        for i in range(B, D):
            if s[i] == '
                cnt += 1
            else:
                cnt = 0
            if cnt > 1:
               return False 
        cnt = 0
        for i in range(A, C):
            if s[i] == '
                cnt += 1
            else:
                cnt = 0
            if cnt > 1:
               return False 
        return True
    else:
        cnt = 0
        flg = False
        for i in range(B, D+1):
            if s[i] == '
                cnt += 1
            else:
                if s[i-1] == '.' and s[i+1] == '.':
                    flg = True
                cnt = 0
            if cnt > 1:
               return False 

        if not flg:
            return False

        cnt = 0
        for i in range(A, C):
            if s[i] == '
                cnt += 1
            else:
                cnt = 0
            if cnt > 1:
               return False 
        return True

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

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


if d < c:
    ans = "No"
    for j in range(b-2, d-1, 1):
        
        if s[j] == "." and s[j+1] == "." and s[j+2] == ".":
            ans = "Yes"
else:
    ans = "Yes"
e = max(c, d)
for i in range(a, e-1, 1):
    if s[i] == "
        ans = "No"

if s[c-1] == "
    ans = "No"

print(ans)

Solution (Python):

import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_matrix(H):
    '''
    H is number of rows
    '''
    return [list(map(int, read().split())) for _ in range(H)]


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read()[:-1] for _ in range(H)]


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols

    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])

    return ret


N, A, B, C, D = read_ints()
S = input()

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

plan = 1  

if D < C:
    plan = 2

if C < B:
    plan = 3

from sys import exit


if plan == 1:
    for s_left, s_right in zip(S[A:], S[A + 1:D]):
        if s_left == '
            print('No')
            exit()
    print('Yes')
elif plan == 2:
    
    for s_left, s_right in zip(S[A:], S[A + 1:C]):
        if s_left == '
            print('No')
            exit()

    for s_left, s_center, s_right in zip(S[B-1:D], S[B:D+1], S[B+1:D+2]):
        if s_left == '.' and s_center == '.' and s_right == '.':
            print('Yes')
            exit()
    print('No')
elif plan == 3:
    
    
    for s_left, s_right in zip(S[A:], S[A+1:C]):
        if s_left == '
            print('No')
            exit()
    for s_left, s_right in zip(S[B:], S[B+1:D]):
        if s_left == '
            print('No')
            exit()
    print('Yes')

Solution (Python):
import sys

sys.setrecursionlimit(10000)
mod = 1000000007


def mul(a, b):
    return ((a % mod) * (b % mod)) % mod


def power(x, y):
    if y == 0:
        return 1
    elif y == 1:
        return x % mod
    elif y % 2 == 0:
        return power(x, y / 2) ** 2 % mod
    else:
        return power(x, y / 2) ** 2 * x % mod


def div(a, b):
    return mul(a, power(b, mod - 2))




































































N, A, B, C, D = map(int, input().split())
S = input()
block = "
ans = "Yes"
if C < D:
    for i in range(A, C):
        if S[i] == block:
            if S[i + 1] == block:
                ans = "No"
                break
    for i in range(B, D):
        if S[i] == block:
            if S[i + 1] == block:
                ans = "No"
                break
else:
    change_frag = False

    for i in range(A, C):
        
        if S[i] == block:
            if S[i + 1] == block:
                ans = "No"
                break
    for i in range(B-1, D):
        
        if S[i] == block:
            if S[i + 1] == block:
                ans = "No"
                break
        elif S[i-1] != block and S[i+1] != block:
                
                change_frag = True

    if not change_frag:
        ans = "No"


print(ans)

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

if C < B:
    if S[A-1:C].find('
    else: print 'No'
elif C < D:
    if S[B-1:D].find('
    elif S[A-1:C].find('
    else:
        print 'Yes'
else:
    if S[B-1:D].find('
    else:
        if S[A-1:C].find('
        else:
            list_s = list(S)
            list_s[B-1] = '
            list_s_1 = list(S)
            list_s_1[D-1] = '
            S_1 = ''.join(list_s)
            S_2 = ''.join(list_s_1)
            if S_1[A-1:C].find('
                if S[B-1:D].find('...') >= 0: print 'Yes'
                else: print 'No'
            else: print 'Yes'

Solution (Python):
I=lambda:map(int,input().split())
N,A,B,C,D=I()
S=input()
if C<D: 
    f=True
    for i in range(A-1,C-1):
        if S[i]==S[i+1]=='
    for i in range(B-1,D-1):
        if S[i]==S[i+1]=='
    print('Yes' if f else 'No')
else:
    f=True
    akichi=False
    for i in range(B-1,D):
        if S[i-1]==S[i]==S[i+1]=='.':akichi=True
    f=True
    for i in range(A-1,C-1):
        if S[i]==S[i+1]=='
    for i in range(B-1,D-1):
        if S[i]==S[i+1]=='
    print('Yes' if f and akichi else 'No')

Solution (Python):
import numpy as np

N,A,B,C,D = list(map(int, input().split()))
S = input()
s = S
ans = "No"
if "
    ans = "No"
else:
    if C < D:
        ans = "No"
        if not "
            if not "
                ans = "Yes"
    else:
        S = S[:C]
        s = S
        
        if not "
            S = S[:D-1] + "
            if not "
                ans = "Yes"
            else:
                ans = "No"
        else:
            ans = "No"

        S = s
        if ans is "No":
            if "..." in S[B-2:D]:
                if not "
                    S = S[:D]
                    if not "
                        ans = "Yes"
                    else:
                        ans = "No"
                else:
                    ans = "No"        

print(ans)

Solution (Python):




N,A,B,C,D = map(int, input().split())
As = [A-1,C-1]
Bs = [B-1,D-1]
S = "

ans = True
if "
  ans = False
elif As[1] > Bs[1]:
  if "..." not in S[Bs[0]:Bs[1]+3]:
    ans = False

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

Solution (Python):
def check(b,d,path):
    seq = False
    for s in path[b:d]:
        if s == '
            if seq:
                return False
            else:
                seq = True
        else:
            seq = False  

    return True  


n,a,b,c,d = map( int, input().split() ) 
npath = input()
path = []
for s in npath:
    path.append(s)

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


ans = True
if c < d:
    ans = check(b,d,path) and check(a,c,path)
else:
    triple = 0
    for s in path[b-1:d+2]:
        if triple == 3:
            break
        if s == '
            triple = 0
        else:
            triple += 1

    if triple == 3:
        ans = check(a,d,path) and check(b,c,path)
    else:
        ans = False



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

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

if "
	print("No")
	exit()

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

print("Yes")

Solution (Python):
N,A,B,C,D=(int(x) for x in input().split())
S=input()
def Solve():
    if '
        return 'No'
    if C<D:
        return 'Yes'
    if '...' in S[B-1:D]:
        return 'Yes'
    if (D!=N and S[D]=='.' and S[D-2]=="." and S[D-1]==".") or (S[B-2]=='.' and S[B-1]=="." and S[B]=="."):
        return 'Yes'
    else:
        return 'No'
    

print(Solve())

Solution (Python):
import sys

sys.setrecursionlimit(10000)
mod = 1000000007


def mul(a, b):
    return ((a % mod) * (b % mod)) % mod


def power(x, y):
    if y == 0:
        return 1
    elif y == 1:
        return x % mod
    elif y % 2 == 0:
        return power(x, y / 2) ** 2 % mod
    else:
        return power(x, y / 2) ** 2 * x % mod


def div(a, b):
    return mul(a, power(b, mod - 2))




































































N, A, B, C, D = map(int, input().split())
S = input()
block = "
ans = "Yes"
if C < D:
    for i in range(A, C):
        if S[i] == block:
            if S[i + 1] == block:
                ans = "No"
                break
    for i in range(B, D):
        if S[i] == block:
            if S[i + 1] == block:
                ans = "No"
                break
else:
    change_frag = False

    for i in range(A, C):
        
        if S[i] == block:
            if S[i + 1] == block:
                ans = "No"
                break
    for i in range(B-1, D):
        
        if S[i] == block:
            if S[i + 1] == block:
                ans = "No"
                break
        elif S[i-1] != block and S[i+1] != block:
                
                change_frag = True

    if not change_frag:
        ans = "No"


print(ans)

Solution (Python):
N,A,B,C,D=map(int,input().split())
S=input()
if C<B and B<D:
    for i in range(A-1,C-1):
        if S[i] == '
            print('No')
            exit()
    for p in range(B-1,D-1):
        if S[p] == '
            print('No')
            exit()
    print('Yes')
    exit()
elif B<C and C<D:
    for i in range(A-1,D-1):
        if S[i]=='
            print('No')
            exit()
    print('Yes')
    exit()
elif D<C:
    for j in range(A-1,C-1):
        if S[j]=='
            print('No')
            exit()
    if any(S[k-1]=='.' and S[k]=='.' and S[k+1]=='.' for k in range(B-1,D)):
        print('Yes')
        exit()
print('No')

Solution (Python):
from sys import stdin
import numpy as np









N, A, B, C, D = [int(x) for x in stdin.readline().rstrip().split()]
S = stdin.readline().rstrip().split()[0]

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

stone = []
count=0
for i in range(N-1):
  if S[i]=="
    count +=1
  stone.append(count)

def f(i, j):
  s = stone[j-1] - stone[i]
  if s==0:
    return True
  else:
    return False

if C < B:
  if f(A,C) and f(B,D):
    print("Yes")
  else:
    print("No")
elif C < D:
  if f(A,C) and f(B,D):
    print("Yes")
  else:
    print("No")
else:
  space = []
  count=0
  for i in range(N-2):
    if S[i]=="." and S[i+1]=="." and S[i+2]==".":
      count +=1
    space.append(count)
  
  s = space[D-1]-space[B-2]
  if s != 0:
    if f(A,C):
      print("Yes")
    else:
      print("No")
  else:
    print("No")

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

Solution (Python):
import numpy as np

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

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

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

if C < D:
	if D < N:
		if '
			print('No')
		else:
			print('Yes')
	else:
		if '
			print('No')
		else:
			print('Yes')
else:
	if C < N:
		if '
			print('No')
			sys.exit()
	else:
		if '
			print('No')
			sys.exit()
	if (S[D-2] == '.') & (S[D] == '.'):
		print('Yes')
	else:
		if '...' in S[B-2:D]:
			print('Yes')
		else:
			print('No')