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 = list(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"
ans = True
flag = 0

while a<n and b<n:
  while a<b:
    if a==c:
      break
    elif a+1<n and a+1<b and s[a+1]==".":
      s[a] = "."
      s[a+1] = "A"
      a += 1
    elif a+2<n and a+2<b and s[a+2]==".":
      s[a] = "."
      s[a+2] = "A"
      a += 2
    else:
      break

  if a+2<n and d<c and s[a+1]=="B" and s[a+2]==".":
    s[a] = "."
    s[a+2] = "A"
    a += 2

  if b<a:
    while a<n:
      if a==c:
        break
      elif a+1<n and s[a+1]==".":
        s[a] = "."
        s[a+1] = "A"
        a += 1
      elif a+2<n and s[a+2]==".":
        s[a] = "."
        s[a+2] = "A"
        a += 2
      else:
        ans = False
        break

  if a==c and b==d:
    break
  elif b+1<n and s[b+1]==".":
    s[b] = "."
    s[b+1] = "B"
    b += 1
  elif b+2<n and s[b+2]==".":
    s[b] = "."
    s[b+2] = "B"
    b += 2
  else:
    ans = False
    break

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

Solution (Python):

"""
Created on Sun Jun  2 20:30:09 2019

@author: Yamazaki Kenichi
"""
import sys

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

if S[A] == '
    print('No')
    sys.exit()

goal = True
previous = True
jump = False
for i in range(A + 1, max(C+1,D+1)):
    if S[i] == '.':
        True
    elif S[i-1] == '
        goal = False
    if i >= B and i <= D and i != max(C,D):
        if S[i-1] == '.' and S[i] == '.' and S[i+1] == '.':
            jump = True


if C > D:
    if not jump:
        print('No')
        sys.exit()
if goal:
    print('Yes')
else:
    print('No')

Solution (Python):


from math import *

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

s=input()


flg=0


for i in range(b,d):
	if(s[i]=='
		flg=1

for i in range(a,c):
	if(s[i]=='
		flg=1

if(c>d):
	ff=1
	for i in range(b,d+1):
		if(s[i]=='.' and s[i-1]=='.' and s[i-2]=='.'):
			ff=0

	if(ff):
		flg=1

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

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

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

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

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

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

a-=1
b-=1
c-=1
d-=1
if d>c:
    dp = [False]*(n+3)
    dp[d] = True
    for i in range(d-1,-1,-1):
        if s[i] == '
            continue
        if dp[i+1] or dp[i+2]:
            dp[i] = True
    
    cp = [False]*(n+3)
    cp[c] = True
    for i in range(c-1,-1,-1):
        if s[i] == '
            continue
        if cp[i+1] or cp[i+2]:
            cp[i] = True
    if cp[a] and dp[b]:
        print('Yes')
    else:
        print('No')
else:
    dp = [False]*(n+3)
    dp[d] = True
    for i in range(d-1,-1,-1):
        if s[i] == '
            continue
        if dp[i+1] or dp[i+2]:
            dp[i] = True
    
    cp = [False]*(n+3)
    cp[c] = True
    for i in range(c-1,-1,-1):
        if s[i] == '
            continue
        if cp[i+1] or cp[i+2]:
            cp[i] = True
    

    res = 0
    cnt = 0
    for i in range(b-1,d+2):
        if s[i] == '.':
            cnt += 1
        else:
            res = max(cnt,res)
            cnt = 0
    res = max(res,cnt)
    if cp[a] and dp[b] and res >= 3:
        print('Yes')
    else:
        print('No')

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

if C < D:
	judge = 0
	for i in range(B,D-1):
		if s[i] == "
			judge = 1
	for i in range(A,C-1):
		if s[i] == "
			judge = 1
	if judge == 1:
		print("No")
	else:
		print("Yes")
		exit()
		
if C > D:
	judge = 0
	judge1 = 0
	for i in range(B,D-1):
		if s[i] == "
			judge = 1
	for i in range(B-2,D-1):
		if s[i] == "." and s[i+1] == "." and s[i+2] == ".":
			judge1 = 1
	if judge1 == 0:
		judge = 1
	for i in range(A,C-1):
		if s[i] == "
			judge = 1
	if judge == 1:
		print("No")
	else:
		print("Yes")
		exit()

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

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

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

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

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

needOver = False
if C > D:
    needOver = True

ans = 'Yes'
overPos = 0
if needOver:
    canOver = False
    for i in range(B-1, D):
        if S[i-1] == '.' and S[i] == '.' and S[i+1] == '.':
            canOver = True
            break
    if not canOver:
        ans = 'No'

for i in range(A+1-1, C):
    if S[i-1] == '
        ans = 'No'
        break

for i in range(B+1-1, D):
    if S[i-1] == '
        ans = 'No'
        break

print(ans)

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

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

Solution (Python):

import numpy as np
from functools import lru_cache
import time

def main(): 
    if True:
        N,A,B,C,D = list(map(int, input().split()))
        S = np.asarray(list(str(input())))
    else:
        pass

    scount = 0
    dcount = 0
    swapok = False
    
    for i in range(A,max(C,D)):
        s = S[i]
        if s == "
            dcount = 0
            scount += 1
            if scount == 2:
                print("No")
                exit()
        else:
            scount = 0
            if D > i > B-3:
                dcount += 1
                if dcount == 3:
                    swapok = True
    
    if (C>D) & (not swapok):
        if (S[D-2] == ".") & (S[D] == "."):
            print("Yes")
        else:
            print("No")
    else:
        print("Yes")

if __name__ =='__main__':
    main()

Solution (Python):

import sys

YES = "Yes"  
NO = "No"  

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

    if A > C or B > D:
        print(NO)
        return

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

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

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

        if not bOK:
            print(NO)
            return

    print(YES)








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



def readInt():
    return int(input())

def readList():
    return list(input().split())

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

def check(s, x_from, x_to):
    for x in range(x_from, x_to):
        can_jump = False
        for dx in range(0, 2):
            if s[x+dx] == '.':
                can_jump = True
                break
        if not can_jump:
            return False
    return True


def main():
    n, a, b, c, d = readListI()
    a -= 1
    b -= 1
    c -= 1
    d -= 1
    s = input()

    if c > d:
        
        can_swap = False
        for x in range(b-1, d):
            can_swap_here = True
            for dx in range(0, 3):
                if s[x+dx] == '
                    can_swap_here = False
                    break
            if can_swap_here:
                can_swap = True
                break
        if not can_swap:
            print("No")
            return

    
    if not check(s, a, c):
        print("No")
        return
    if not check(s, b, d):
        print("No")
        return
    print("Yes")


if __name__ == '__main__':
    main()

Solution (Python):

N,A,B,C,D  = map(int,input().split())
S = input()
ans = 'Yes'
if C < D:
    befA = S[A-1]
    for i in range(A,C):
        
        if S[i] == '
            ans = 'No'
            break
        befA = S[i]
    befB = S[B-1]
    for j in range(B,D):
        
        if S[j] == '
            ans = 'No'
            break
        befB = S[j]
elif D < C:
    befA = S[A-1]
    for i in range(A,C):
        
        if S[i] == '
            ans = 'No'
            break
        befA = S[i]
    for k in range(B-1,D):
        ans = 'No'
        if S[k-1]=='.' and S[k] == '.' and S[k+1]=='.':
            ans = 'Yes'
            break
print(ans)

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

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

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

print('Yes')

Solution (Python):

"""
AtCoder A
"""

import math
import numpy as np











def main():
    N, A, B, C, D = list(map(int,input().split()))
    S= str(input())
    
    if C>D:
        if '
            print("No")
        elif "..." in S[B-2:D+1]:
            print("Yes")
        else:
            print("No")
    else:
        if '
            print("No")
        else:
            print("Yes")
    
    
    
if __name__ == "__main__":
    main()

Solution (Python):
import sys,heapq
from collections import deque,defaultdict
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
DBG = True 
def ddprint(x):
  if DBG:
    print(x)

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

Solution (Python):
def li():
    return list(map(int, input().split()))


if __name__ == "__main__":
    [n, a, b, c, d] = li()
    s = input()
    if c < d:
        route = s[a:d - 1]
        
        possible = True
        before = "."
        for si in route:
            if before == si == "
                possible = False
                break
            before = si
    elif d < c:
        route = s[a:d - 1]
        
        possible = True
        before = "."
        for si in route:
            if before == si == "
                possible = False
                break
            before = si

        cross_possible = False
        route = s[b:d + 1]
        
        before = [s[b - 2], s[b - 1]]
        for si in route:
            before.append(si)
            before = before[-3:]
            if before[0] == before[1] == before[2] == ".":
                cross_possible = True
        possible = possible and cross_possible

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

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

ans = "Yes"

for i in range(A - 1, max(C, D)):
  if i >= A and S[i] == "
    ans = "No"
    break


if D < C:
  
  cnt = 0
  tmp = 0
  for i in range(B - 2, min(D + 1, N)):
    if S[i] == ".":
      tmp += 1
    else:
      cnt = max(cnt, tmp)
      tmp = 0
  cnt = max(cnt, tmp)
  
  if cnt < 3:
    ans = "No"
print(ans)

Solution (Python):
import sys

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


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

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




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

Solution (Python):
def double_rock(field, begin ,end):
  rock = False
  for i in range(begin, end + 1):
    if field[i] == '
      if rock:
        
        return True
        break
      rock = True
    else:
      rock = False
  return False

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

s = input()
field = list(s)

if c < d:
  if double_rock(field, a, d):
    ans = "No"
  else:
    ans = "Yes"
else:
  b_ok = False
  dot_count = 0
  for i in range(b-1, d+2):
    if field[i] == '.':
      dot_count += 1
    else:
      dot_count = 0
    if dot_count == 3:
      b_ok = True
  if b_ok and not double_rock(field, a, c):
    ans = "Yes"
  else:
    ans = "No"
print(ans)

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

ans = True

dp = [False]*n
dp[b-1] = True

for i in range(b-1, d):
    if s[i] != ".":
        continue
    for j in range(1,3):
        if i+j < n:
            if s[i+j] != ".":
                continue
            if not dp[i+j]:
                dp[i+j] = dp[i]
if not dp[d-1]:
    ans = False


dp = [False]*n
dp[a-1] = True

for i in range(a-1, c):
    if s[i] != ".":
        continue
    for j in range(1,3):
        if i+j < n:
            if s[i+j] != ".":
                continue
            if not dp[i+j]:
                dp[i+j] = dp[i]
if not dp[c-1]:
    ans = False

if d < c:
    l = max(b-2, 0)
    r = min(d, n-1)
    if "..." not in s[l:r+1]:
        ans = False

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

Solution (Python):
import sys
sys.setrecursionlimit(10**7)
import numpy as np





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

    
    if s[a:c+1].find("
        print("No")
    else:
        
        if b < d and d < c:
            
            
            
            
            if s[b-1:d+2].find("...") > -1:
                print("Yes")
            else:
                print("No")
        else:
            print("Yes")
solve()

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

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

Solution (Python):
n, a, b, c, d = map(int, input().split())
s = input()
flag = True
for i in range(a - 1, max(c, d) - 1):
    if s[i:i+2] == "
        flag = False
        break
if flag == False:
    print("No")
else:
    if c < d:
        print("Yes")
    else:
        flag2 = False
        for i in range(b - 2, min(c, d) - 1):
            if s[i:i+3] == "...":
                flag2 = True
                break
        if flag2 == True:
            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

def check():
	for i in range(A + 1, C - 1):
		if S[i] == S[i + 1] == "
			return False

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

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

Solution (Python):
def ok(_to: int, _from: int, S: str)->bool:
    '''_to から _from へ行けるかどうかを判定する
    '''
    for i in range(_to, _from+1):
        if i < _from and S[i] == '
            return False
    return True


def kenken_race(N: int, A: int, B: int, C: int, D: int, S: str)->bool:
    if not ok(A, C, S) or not ok(B, D, S):
        return False

    if C < D:
        
        
        
        return True

    
    
    
    for i in range(B, D+1):
        if S[i-1] == '.' and S[i] == '.' and S[i+1] == '.':
            return True
    return False


if __name__ == "__main__":
    N, A, B, C, D = map(int, input().split())
    S = input()

    yes = kenken_race(N, A-1, B-1, C-1, D-1, S)
    print('Yes' if yes else 'No')

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

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

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

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

def f(x, y):
    flag = False
    for i in range(x + 1, y):
        if S[i] == "
            if flag:
                return True
            flag = True
        else:
            flag = False
    return False


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


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

Solution (Python):
N,A,B,C,D = map(int,input().split())
S = input()
rock = []
for i in range(N):
	if S[i] == '
		rock.append(i+1)

nRock = len(rock)


for i in range(nRock-1):
	if rock[i+1] - rock[i] == 1:
		if A < rock[i] or B < rock[i]:
			if C > rock[i] or D > rock[i]:
				print("No")
				exit()


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


for i in range(nRock):
	if i == 0:
		if rock[i] >= 4:
			if B < rock[i]-1:
				print("Yes")
				exit()
		continue
	if rock[i] - rock[i-1] > 3:
		if B < rock[i]-1:
			if D == rock[i-1]+1:
				print("No")
				exit()
			else:
				print("Yes")
				exit()
print("No")

Solution (Python):
from sys import exit, setrecursionlimit, stderr, stdin
from functools import reduce
from itertools import *
from collections import defaultdict, Counter
from bisect import bisect
import functools

setrecursionlimit(10**7)

def input():
  return stdin.readline().strip()

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

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

def reachable(i, j):
  return not any(S[k] == S[k+1] == "

def swappable(i, j):
  return any(S[k-1] == S[k] == S[k+1] == "." for k in range(i, j+1))

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

possible = reachable(A, C) and reachable(B, D)

if D < C:
  
  swapl = swappable(B, D)
  possible = possible and swapl

print("Yes" if possible else "No")

Solution (Python):
from bisect import bisect_left as bisectL

N, A, B, C, D = map(int, input().split())
S = input()
walls = []
prev = ''
for i, c in enumerate(S):
  if prev == '
    walls.append(i)
  prev = c

if bisectL(walls, A-1) == bisectL(walls, C-1) and bisectL(walls, B-1) == bisectL(walls, D-1):
  if C < D:
    print('Yes')
    exit()
  else:
    if '...' in S[B-2:D+1]:
      print('Yes')
      exit()
print('No')

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

c1 = all([s[x:x+2] != '
c2 = all([s[x:x+2] != '

if c > d:
    c3 = any([s[x:x+3] == '...' for x in range(b - 2, d - 1)])
    if c1 and c2 and c3:
        print('Yes')
    else:
        print('No')
else:
    if c1 and c2:
        print('Yes')
    else:
        print('No')

Solution (Python):
import numpy as np

N,A,B,C,D = map(int,input().split())
S = np.array((False,)+tuple(map(lambda x: x == '

def check1(i,j):
    return not np.any(S[i:j] & S[i+1:j+1])

def check2(i,j):
    return np.any((~S[i-1:j])&(~S[i:j+1])&(~S[i+1:j+2]))

if C < D:
    print('Yes' if check1(A,C) and check1(B,D) else 'No')
else:
    print('Yes' if check2(B,D) and check1(A,C) else 'No')

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

def canJump(check):
    prev = False
    for c in check:
        if c == '
            if prev:
                return False
            else:
                prev = True
        else:
            prev = False
    return True

def canJump2(check):
    ren = 0
    for c in check:
        if c == '.':
            ren += 1
        else:
            ren = 0
        if ren == 3:
            return True
    return False


if c < b:
    check1 = s[a:c]
    check2 = s[b:d]
    if canJump(check1) and canJump(check2):
        print('Yes')
    else:
        print('No')

elif c < d:
    check = s[a:d]
    if canJump(check):
        print('Yes')
    else:
        print('No')

else:
    check1 = s[a:c]
    check2 = s[b-2:d+1]
    if canJump(check1) and canJump2(check2):
        print('Yes')
    else:
        print('No')

Solution (Python):
import sys

from fractions import gcd





from itertools import accumulate













input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def li(): return list(input().rstrip())


YES = "Yes"  
NO = "No"  

def iterate_tokens():
    for line in sys.stdin:
        for word in line.split():
            yield word


if __name__ == '__main__':

    tokens = iterate_tokens()
    N = int(next(tokens))  
    A = int(next(tokens))  
    B = int(next(tokens))  
    C = int(next(tokens))  
    D = int(next(tokens))  
    S = list(next(tokens))  

    
    dblock = set()
    for i in range(A,max(C,D)-1):
        if S[i] == '
            dblock.add(i+1)
    
    if D > C:
        if dblock == set():
            print(YES)
        else:
            print(NO)
    else:
        if dblock == set():
            for i in range(B - 2, D - 1):
                if S[i] == '.' and S[i + 1] == '.' and S[i + 2] == '.':
                    print(YES)
                    sys.exit()
                else:
                    continue
            else:
                print(NO)
        else:
            print(NO)

Solution (Python):
import sys
n, a, b, c, d = map(int, input().split())
s = input()
snuke, fnuke, gnuke = 0, 0, 0
s_max, f_max, g_max = 0, 0, 0
for i in range(a-1, c):
	if s[i] == "
		snuke += 1
		s_max = max(s_max, snuke)
	else:
		snuke = 0
for i in range(b-1, d):
	if s[i] == "
		fnuke += 1
		f_max = max(f_max, fnuke)
	else:
		fnuke = 0
if c>d:
	for i in range(b-2, d+1):
		if s[i] == ".":
			gnuke += 1
			g_max = max(g_max, gnuke)
		else:
			gnuke = 0

if s_max > 1 or f_max > 1:
	print("No")
elif c < d:
	print("Yes")
else:
	if g_max >= 3:
		print("Yes")
	else:
		print("No")

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

def check_cont_rock(s, e):
  use_road = road[s:e]
  return "

def check_cont_road(s, e):
  use_road = road[s:e]
  return "..." in use_road

if D > C:
  if check_cont_rock(A-1, D-1):
    print("No")
  else:
    print("Yes")
else:
  if check_cont_rock(A-1, C-1):
    print("No")
  else:
    if check_cont_road(B-2, D+1):
      print("Yes")
    else:
      print("No")

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

if S.count('
    print('No')
else:
    if change.count('...') > 0:
        print('Yes')
    elif C < D:
        print('Yes')
    else:
        print('No')

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

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

tmp = 0
for i in range(B-1, D):
    if S[i] == "
        tmp += 1
    if S[i] == ".":
        tmp = 0
    if tmp == 2:
        print("No")
        sys.exit()


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

Solution (Python):


def main():
    n, a, b, c, d = map(int, raw_input().split())
    a -= 1
    b -= 1
    c -= 1
    d -= 1
    s = raw_input()
    ok = False
    while b < d:
        if s[b - 1] == '.' and s[b + 1] == '.':
            ok = True
        if s[b + 1] == '.':
            b += 1
        elif b + 2 < n and s[b + 2] == '.':
            b += 2
        else:
            break
    if b != d:
        print 'No'
        return
    if b + 1 < n and s[b - 1] == '.' and s[b + 1] == '.':
        ok = True
    while a < c:
        if s[a + 1] == '.':
            a += 1
        elif a + 2 < n and s[a + 2] == '.':
            a += 2
        else:
            break
    if a != c:
        print 'No'
    elif c < d or ok:
        print 'Yes'
    else:
        print 'No'


if __name__ == '__main__':
    main()

Solution (Python):
N,A,B,C,D=map(int,input().split())
A-=1
B-=1
C-=1
D-=1
S=input()
l=[0]*N
r=[0]*N
stack=[A]
dx=[1,2]
while(stack):
    x=stack.pop()
    l[x]=1
    for d in dx:
        X=x+d
        if X<0 or N<=X or l[X]==1 or S[X]=="
            continue
        stack.append(X)
stack=[B]
dx=[1,2]
while(stack):
    x=stack.pop()
    r[x]=1
    for d in dx:
        X=x+d
        if X<0 or N<=X or r[X]==1 or S[X]=="
            continue
        stack.append(X)
if C>D:
    t=False
    for i in range(N-3):
        if S[i:i+3]=="..." and l[i]==1 and r[i+1]==1:
            t=True
            break
    if t:
        if l[C]==1 and r[D]==1:
            print("Yes")
            quit()
    print("No")
else:
    if l[C]==1 and r[D]==1:
        print("Yes")
    else:
        print("No")

Solution (Python):
N, A, B, C, D = map(int, input().split())
S = input()
S = '.' + S
if C < D:
    ans = (
        'Yes' if '
        'No'
    )
else:
    i = A
    j = B
    while i < C:
        if i + 1 == C or i + 2 == C:
            ans = 'Yes'
            break
        elif i + 1 <= C and S[i + 1] == '.' and i + 1 != j:
            i += 1
        elif i + 2 <= C and S[i + 2] == '.' and i + 2 != j:
            i += 2
        else:
            if j + 1 <= D and S[j + 1] == '.':
                j += 1
            elif j + 2 <= D and S[j + 2] == '.':
                j += 2
            else:
                ans = 'No'
                break

print(ans)

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

def aida(x, y, list):
    
    iwa=0
    space=0
    for l in list[x-1:y]:
        if l=="
            space=0
            if iwa==1:
                return 0
            else:
                iwa=1
        else:
            iwa=0
            if space==2:
                return 2
            elif space==1:
                space=2
            else:
                space=1
    return 1 
    


if c<b:
    t=aida(a,c,road)
    u=aida(b,d,road)
    if t>0 and u>0:
        print('Yes')
    else:
        print('No')
elif c<d:
    t=aida(a,c,road)
    u=aida(b,d,road)
    if t>0 and u>0:
        print('Yes')
    else:
        print('No')
else:
    t=aida(a,c,road)
    u=aida(b-1,min(d+1,n),road)
    
    if t>0 and u==2:
        print('Yes')
    else:
        print('No')

Solution (Python):
import numpy as np
words = lambda t : list(map(t, input().split()))

n,a,b,c,d = words(int)
s = input()

def verify(x,y):
    posa = x
    res = True
    while posa < y:
        
        if (posa+1 == y or posa+2 == y) and s[y] == '.':
            break
        if s[posa+1] == '
            res = False
            break
        if s[posa+2] == '.':
            posa += 2
        elif s[posa+1] == '.':
            posa += 1
    return res


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

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

sys.setrecursionlimit(10 ** 7)

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

n,a,b,c,d = li_()
n += 1
s = ns()


if c < d:
    if "
        print("No")

    else:
        print("Yes")

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

    elif "
        print("No")

    else:
        print("Yes")