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()
X = max(C,D)
rock = 0
check = 0
for i in S[A:X]:
    if i == '
        rock += 1
    else:
        rock = 0
    if rock == 2:
        check = 1
        break
if check == 0 and C > D:
    plane = 0
    pcheck = 0
    for i in S[B-2:D+1]:
        if i == '.':
            plane += 1
            if plane == 3:
                pcheck = 1
                break
        else:
            plane = 0
    if pcheck == 0:
        check = 1
if check == 0:
    print('Yes')
else:
    print('No')

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

def is_possible(start, goal):
    for i in range(start, goal - 1):
        if s[i] == "
            return False
    return True
  
def is_possible2(start, goal):
    for i in range(start, goal):
        if s[i - 1] == "." and s[i] == "." and s[i + 1] == ".":
            return True
    return False

if c < d:
    if is_possible(a - 1, c) and is_possible(b - 1, d):
        print("Yes")
    else:
        print("No")
else:
    if is_possible(a - 1, c) and is_possible(b - 1, d) and is_possible2(b - 1, d):
        print("Yes")
    else:
        print("No")

Solution (Python):
n, a, b, c, d = map(int, input().split())
a -= 1
b -= 1
c -= 1
d -= 1
s = input()
def is_a(x, y):
  for i in range(x, y-1):
    if s[i]==s[i+1]=="
      return False
  return True
def is_f(x, y):
  for i in range(x, y+1):
    if s[i-1]==s[i]==s[i+1]==".":
      return True
  return False

ans = "No"
if is_a(a, b) and is_a(c, d):
  if c < d or is_f(b, d):
    ans = "Yes"
print(ans)

Solution (Python):

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

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

end = max(c, d)

for i in range(a, end):
    if s[i] == "
        print("No")
        exit()
        


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

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

A-=1;B-=1;C-=1;D-=1
'''
A→C
B→D
順序としてありえるのは
A<B<D<C
A<B<C<D
A<C<B<D
C<Dなら飛び越える必要がない
C>Dなら飛び越える必要がある
飛び越えを成功させるためには3連続の.が途中にあることが必要十分である
'''
if C<D:
    
    Snuke=[0 for i in range(N)]
    Fnuke=[0 for i in range(N)]
    Snuke[A]=1
    Fnuke[B]=1
    for i in range(1,N):
        if S[i]=="
            continue
        if Snuke[i-1]==1:
            Snuke[i]=1
        if i>1 and Snuke[i-2]==1:
            Snuke[i]=1
        if Fnuke[i-1]==1:
            Fnuke[i]=1
        if i>1 and Fnuke[i-2]==1:
            Fnuke[i]=1
    if Snuke[C]==1 and Fnuke[D]==1:
        print("Yes")
    else:
        print("No")
else:
    
    
    Snuke=[0 for i in range(N)]
    Fnuke=[0 for i in range(N)]
    Snuke[A]=1
    Fnuke[B]=1
    for i in range(1,N):
        if S[i]=="
            continue
        if Snuke[i-1]==1:
            Snuke[i]=1
        if i>1 and Snuke[i-2]==1:
            Snuke[i]=1
        if Fnuke[i-1]==1:
            Fnuke[i]=1
        if i>1 and Fnuke[i-2]==1:
            Fnuke[i]=1
    flag=0
    for i in range(B,D+1):
        if S[i-1]=="." and S[i]=="." and S[i+1]==".":
            flag=1
            break
    if Snuke[C]==1 and Fnuke[D]==1 and flag==1:
        print("Yes")
    else:
        print("No")

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


def solve():
    if '
        return 'No'

    if C > D:
        if '...' not in S[B - 1:D + 2]:
            return 'No'

    return 'Yes'


print(solve())

Solution (Python):

si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
n,a,b,c,d=nl()
s=si()

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

Solution (Python):
import sys

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

tmp = ""
for i in range(a,c):
	if s[i] == tmp == "
		print("No")
		sys.exit()
	tmp = s[i]

for i in range(b,d):
	if s[i] == tmp == "
		print("No")
		sys.exit()
	tmp = s[i]

if c < d:
	print("Yes")
	sys.exit()

else:
	cnt = 0
	for i in range(b-2,d+1):
		if s[i] == ".":
			cnt += 1
			if cnt == 3:
				print("Yes")
				sys.exit()
		else:
			cnt = 0

print("No")

Solution (Python):
N, A, B, C, D = map(int,input().split())
S = list(input())
S = [0] + S
for i in range(A,C):
    if S[i] == S[i+1] == '
        print('No')
        exit()
for i in range(B,D):
    if S[i] == S[i+1] == '
        print('No')
        exit()
if C < D:
    print('Yes')
else:
    if S[B-1] == S[B+1] == '.':
        print('Yes')
        exit()
    else:
        count = 0
        for i in range(B,D):
            if S[i] == S[i+1] == S[i+2] == '.':
                print('Yes')
                exit()
    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() + "
def chk(l, r):
    for i in range(l, r-1):
        if S[i:i+2] == "
            return 0
    return 1

def chk3(l, r):
    for i in range(l, r):
        if S[i:i+3].count("
            return 1
    return 0

if chk(A, C) and chk(B, D) and (C < D or chk3(B-1, D)):
    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() + "
def chk(l, r):
    for i in range(l, r-1):
        if S[i:i+2] == "
            return 0
    return 1

def chk3(l, r):
    for i in range(l, r):
        if S[i:i+3].count("
            return 1
    return 0

if chk(A, C) and chk(B, D) and (C < D or chk3(B-1, D)):
    print("Yes")
else:
    print("No")

Solution (Python):
N,A,B,C,D=[int(c) for c in input().split()]
S=input()
print("Yes" if ("

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

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

Solution (Python):
n, a, b, c, d = map(int, input().split())
s = input()
if '
    print('No')
elif c < d or '...' 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 c<d:
  if "
  ans="Yes"
  for i in range(c-a):
    if s[a+i-1]==s[a+i]=="
  for i in range(d-b):
    if s[b+i-1]==s[b+i]=="
  print(ans)
else:
  if "
  ans="No"
  for i in range(d-b+1):
    if s[b+i-2]==s[b+i-1]==s[b+i]==".":ans="Yes"
  for i in range(c-a):
    if s[a+i-1]==s[a+i]=="
  print(ans)

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

def test(x,y):
  
  substr = S[x:y-1]
  return substr.find('

bl = test(A,C) and test(B,D)
if C > D:
  
  
  can_swap = False
  for b in range(B-1,D):
    if S[b] == '
      continue
    if S[b-1] == '.' and S[b+1] == '.':
      can_swap = True
      break
  bl = bl and can_swap
answer = 'Yes' if bl else 'No'
print(answer)

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:
    if "
        print("No")
        exit()

    print("Yes")

else:
    for i in range(b, d+1):
        if s[i] != "
            print("Yes")
            exit()

    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 "
    print("No")
    exit()

if c < d:
    for i in range(b, d):
        if s[i:i+2] == "
            print("No")
            exit()

    print("Yes")

else:
    for i in range(b, d+1):
        if s[i] != "
            print("Yes")
            exit()

    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 "
    print("No")
    exit()

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

    print("Yes")

else:
    for i in range(b, d+1):
        if s[i] != "
            print("Yes")
            exit()

    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:
    for i in range(b, d):
        if s[i] == "
            print("No")
            exit()

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

else:
    for i in range(b, d+1):
        if s[i] != "
            print("Yes")
            exit()

    print("No")

Solution (Python):
import sys


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

S = {i : s for i, s in enumerate(input(), 1)}



stay_B = False
if S[B-1] == '.':
  continuous_empty = 2
else:
  continuous_empty = 1

while B != D:
  if S[B+1] == '.':
    B += 1
    continuous_empty += 1
    if continuous_empty == 3:
      stay_B = True
  else:
    if S[B+2] == '.':
      B += 2
      continuous_empty = 1
    else:
      print("No")
      sys.exit()
    

if (D > C) or stay_B or (continuous_empty == 2 and S[D+1] == '.'):
  while A != C:
    if S[A+1] == '.':
      A += 1
    else:
      if S[A+2] == '.':
        A += 2
      else:
        print("No")
        sys.exit()

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

Solution (Python):
import sys


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

S = {i : s for i, s in enumerate(input(), 1)}

stay_B = False
if S[B-1] == '.':
  continuous_empty = 2
else:
  continuous_empty = 1

while B != D:
  if S[B+1] == '.':
    B += 1
    continuous_empty += 1
    if continuous_empty == 3:
      stay_B = True
  else:
    if S[B+2] == '.':
      B += 2
      continuous_empty = 1
    else:
      print("No")
      sys.exit()
    

if (D > C) or stay_B or (continuous_empty == 2 and S[D+1] == '.'):
  while A != C:
    if S[A+1] == '.':
      A += 1
    else:
      if S[A+2] == '.':
        A += 2
      else:
        print("No")
        sys.exit()

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

Solution (Python):
import sys


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

S = {i : s for i, s in enumerate(input(), 1)}


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

  while A != C:
    if S[A+1] == '.':
      A += 1
    else:
      if S[A+2] == '.':
        A += 2
      else:
        print("No")
        sys.exit()
  print("Yes")
  




else:
  
  stay_B = False
  if S[B-1] == '.':
    continuous_empty = 2
  else:
    continuous_empty = 1

  while B != D:
    if S[B+1] == '.':
      B += 1
      continuous_empty += 1
      if continuous_empty == 3:
        stay_B = True
    else:
      if S[B+2] == '.':
        B += 2
        continuous_empty = 1
      else:
        print("No")
        sys.exit()
   
  
  if stay_B or (continuous_empty == 2 and S[D+1] == '.'):
    while A != C:
      if S[A+1] == '.':
        A += 1
      else:
        if S[A+2] == '.':
          A += 2
        else:
          print("No")
          sys.exit()
    print("Yes")
      
  
  else:
    print("No")

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

if (a > b and c > d) or (a < b and c < d):
  rock = 0
  for i in range(a-1, c):
    if l[i] == '
      rock += 1
      if rock == 2:
        ans = 'No'
        break
    else:
      rock = 0
  rock = 0
  for i in range(b-1, d):
    if l[i] == '
      rock += 1
      if rock == 2:
        ans = 'No'
        break
    else:
      rock = 0
  if ans == '':
    ans = 'Yes'
else:
  rock = 0
  for i in range(a-1, c):
    if l[i] == '
      rock += 1
      if rock == 2:
        ans = 'No'
        break
    else:
      rock = 0
  rock = 0
  for i in range(b-1, d):
    if l[i] == '
      rock += 1
      if rock == 2:
        ans = 'No'
        break
    else:
      rock = 0
  blank = 0
  for i in range(max(a, b)-2, min(c, d)+1):
    if l[i] == '.':
      blank += 1
      if blank == 3:
        ans = 'Yes'
        break
    else:
      blank = 0    
  if ans == '':
    ans = 'No'

print(ans)

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

ans = "Yes"
is_reversed = False
flag = False


if D < C:
  is_reversed = True

for i in range(A,max(C,D) -1):
  if S[i] == S[i + 1] == "
    ans = "No"
if is_reversed == True:
  for i in range(B - 2,D - 1):
    if S[i] == S[i + 1] == S[i + 2] == ".":
      flag = True
    
    
    
    
    
    
  
  
  if flag == False:
    ans = "No"
print(ans)

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

S = ["$"] + list(input())

if A < B < D < C:
    flag = False

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

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

Solution (Python):
from fractions import gcd

from heapq import*
import math
from collections import defaultdict, Counter, deque
from bisect import *
import itertools
import fractions
import sys
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7



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



if __name__ == '__main__':
    main()

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,A,B,C,D = map(int,readline().split())
S = '.' + read().rstrip().decode('utf-8')

if A > B:
    A,B = B,A
    C,D = D,C

from_A = [False] * (N+10) 
from_A[A] = True
for i,x in enumerate(S):
    if x == '
        continue
    if from_A[i-1] or from_A[i-2]:
        from_A[i] = True
from_A = from_A[:N+1]

from_B = [False] * (N+10) 
from_B[B] = True
for i,x in enumerate(S):
    if x == '
        continue
    if from_B[i-1] or from_B[i-2]:
        from_B[i] = True
from_B = from_B[:N+1]

from_A[C+1:] = [False] * (N - C)
from_B[D+1:] = [False] * (N - B)

if not (from_A[C] and from_B[D]):
    print('No')
    exit()

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



can_swap = False
for i in range(0,N-1):
    j,k = i+1,i+2
    if from_A[i] and from_A[k] and from_B[j]:
        can_swap = True
        break

answer = 'Yes' if can_swap else 'No'
print(answer)

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

if C < D:
    flag = True
    for i in range(A-1,D-1):
        if S[i]=='
            flag = False
    print('Yes' if flag else 'No')
else:
    flag = False
    for i in range(B-1,D):
        cnt = 0
        for j in {-1,0,1}:
            if S[i+j]=='.':
            	cnt += 1
        if cnt == 3:
            flag = True
    for i in range(A-1,C-1):
        if S[i]=='
            flag = False

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

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

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

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

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

def f(x, y, s):
  tmp=[0]*(N+1)
  tmp[x]=1
  if s[x+1]=='.':
    tmp[x+1]=1
  i=x+2
  while i<=y:
    if s[i]=='.' and (tmp[i-2]==1 or tmp[i-1]==1):
      tmp[i]=1
    i+=1
  if tmp[y]>0:
    out=True
  else:
    out=False
    
  return out

if C<D:
  if f(A, C, S)==True and f(B, D, S)==True:
    print('Yes')
  else:
    print('No')
  exit()

def g(x, y, s):
  out=False
  for i in range(x, y+1):
    if s[i-1:i+2]=='...':
      out=True
  return out
  
if f(A, C, S)==True and f(B, D, S)==True and g(B, D, S)==True:
  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 A<C<B<D:
        for i in range(A-1,C-1):
            if S[i] == S[i+1] == "
                print(NO)
                return
        for i in range(B-1,D-1):
            if S[i] == S[i+1] == "
                print(NO)
                return     
        print(YES)
        return
    
    if A<B<C<D:
        for i in range(A-1,C-1):
            if S[i] == S[i+1] == "
                print(NO)
                return
        for i in range(B-1,D-1):
            if S[i] == S[i+1] == "
                print(NO)
                return     
        print(YES)
        return

    if A<B<D<C:
        for i in range(B-1,D):
            if S[i-1] == S[i] == S[i+1] == ".":
                print(YES)
                return   
        print(NO)
        return     

    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 = [int(i) - 1 for i in sys.stdin.readline().split()]
n += 1
s = input()
s_memo_ls = [0 for i in range(n)]
s_memo_ls[a] = 1
f_memo_ls = [0 for i in range(n)]
f_memo_ls[b] = 1

for i in range(a+1, c+1):
    if s[i] == "
        continue
    s_memo_ls[i] = max(s_memo_ls[i - 1], s_memo_ls[i - 2])
for i in range(b+1, d+1):
    if s[i] == "
        continue
    f_memo_ls[i] = max(f_memo_ls[i - 1], f_memo_ls[i - 2])

if s_memo_ls[c] and f_memo_ls[d]:
    flg = d > c
    for i in range(1, n - 1):
        if s[i-1] == s[i] == s[i+1] == ".":
            flg |= f_memo_ls[i] and s_memo_ls[i-1]
        if flg:
            break
    print("Yes" if flg else "No")
else:
    print("No")

Solution (Python):
n,a,b,c,d=map(int,input().split())
s=["."]+list(input())
k=0
for i in range(a,c):
    if s[i]==s[i+1]=="
        k=1
for i in range(b,d):
    if s[i]==s[i+1]=="
        k=1
if d<c:
    for i in range(b,d+1):
        if s[i]==s[i-1]==s[i+1]==".":
            break
    else:
        k=1

if k==0:
    print("Yes")
else:
    print("No")

Solution (Python):
from sys import exit, stdin
N, A, B, C, D = [int(_)-1 for _ in stdin.readline().rstrip().split()]
S = stdin.readline().rstrip()
if C < D:
    if '
        print('No')
    else:
        print('Yes')
else:
    if '
        print('No')
    else:
        print('Yes')

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

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

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):
def cd(a, b, c, d, s):
    for i in range(b, d + 1):
        if s[i] + s[i + 1] == "
            return "No"
    for i in range(a, c + 1):
        if s[i] + s[i + 1] == "
            return "No"
    return "Yes"


def dc(a, b, c, d, s):
    flag = False
    for i in range(b, d + 1):
        if s[i] + s[i + 1] == "
            return "No"
        if s[i - 1] + s[i] + s[i + 1] == "...":
            flag = True
    for i in range(a, c + 1):
        if s[i] + s[i + 1] == "
            return "No"
    if flag:
        return "Yes"
    else:
        return "No"


if __name__ == "__main__":
    n, a, b, c, d = map(int, input().split())
    a -= 1
    b -= 1
    c -= 1
    d -= 1
    s = input()+"

    if c < d:
        ans = cd(a, b, c, d, s)
    else:
        ans = dc(a, b, c, d, s)
    print(ans)

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

Solution (Python):
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n, a, b, c, d = list(map(int, readline().split()))
    s = str(readline().rstrip().decode('utf-8'))
    if c == d:
        print("No")
    elif c < d:
        print("Yes" if s[a-1:d+1].count("
    elif c > d:
        print("Yes" if s[a-1:c+1].count("


if __name__ == '__main__':
    solve()

Solution (Python):
import sys
sys.setrecursionlimit(10**9)
INF=10**18
def input():
    return sys.stdin.readline().rstrip()

def main():
    N,A,B,C,D=map(lambda x: int(x)-1,input().split())
    N+=1
    S=list(input())
    S.append('
    if C>D:
        f=False
    else:
        f=True
    for i in range(A,C-1):
        if S[i]=='
            print('No')
            exit()
        if D-1>=i>=B-1 and S[i]=='.' and S[i+1]=='.' and S[i+2]=='.':
            f=True
    for i in range(B,D-1):
        if S[i]=='
            print('No')
            exit()
    print('Yes' if f==True else 'No')

if __name__ == '__main__':
    main()

Solution (Python):
[print("Yes") if not "

Solution (Python):
N,A,B,C,D=map(int,input().split())
S=input()
A-=1
B-=1
C-=1
D-=1
def test(i,m):
    while i<N :
        if i==m:
            return(1)
        if i+1<N and S[i+1]==".":
            i+=1
        elif i+2<N and S[i+2]==".":
            i+=2
        else:
            return(0)
    return(0)


if C<D:

    if test(A,C) and test(B,D):
        print("Yes")
    else:
        print("No")
else:
    T=B-1
    if "..." in S[T:min(D+2,N-1)] and test(A,C) and test(B,D):
        print("Yes")
    else:
        print("No")

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

for i in range(b,d+1):
    if i==1:
        continue
    if res[i-2]=="." and res[i-1]=="." and res[i]==".":
        print("Yes")
        exit()
    if res[i-1]=="
        print("No")
        exit()
        
print("No")
exit()

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

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

ans=True
if "
  ans=False
if "
  ans=False

if (A-B)*(C-D)<0:
  commonL=max(A,B)
  if commonL>0:
    commonL-=1
  commonR=min(C,D)
  if commonL<len(S)-1:
    commonR+=1
  if commonR<commonL:
    ans=False
  elif "..." not in S[commonL:commonR+1]:
    ans=False

print(("No","Yes")[ans])

Solution (Python):
import sys


def main():
    n, a, b, c, d = [int(x) for x in sys.stdin.readline().split()]
    s = '

    if '
        ans = 'No'
    else:
        if c < d:
            ans = 'Yes'
        else:
            for i in range(b, d+1):
                if s[i-1] == s[i] == s[i+1] == '.':
                    ans = 'Yes'
                    break
            else:
                ans = 'No'
        
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):

import sys


def main():
    n, a, b, c, d = [int(x) for x in sys.stdin.readline().split()]
    s = '

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

if __name__ == '__main__':
    main()

Solution (Python):

import sys


def main():
    n, a, b, c, d = [int(x) for x in sys.stdin.readline().split()]
    s = '

    if '
        ans = 'No'
    else:
        if c < d:
            ans = 'Yes'
        else:
            for i in range(b, d+1):
                if s[i-1] == s[i] == s[i+1] == '.':
                    ans = 'Yes'
                    break
            else:
                ans = 'No'
        
    print(ans)

if __name__ == '__main__':
    main()

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

readline = sys.stdin.buffer.readline


def main():
    N, A, B, C, D = map(int, readline().split())
    S = readline().decode('UTF-8')
    A -= 1
    B -= 1
    C -= 1
    D -= 1

    if C < D:
        s = A
        g = D
        for i in range(s, g):
            if S[i:i+2] == "
                print('No')
                sys.exit()
        else:
            print('Yes')

    else:
        s = A
        g = C
        for i in range(s, g):
            if S[i:i+2] == "
                print('No')
                sys.exit()

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


main()

Solution (Python):

from itertools import groupby
import sys

n, A, B, C, D = map(int, input().split())
s = input()
if D < C:
    a = [[k, len(list(g))] for k, g in groupby(s[B-2:D+1])]
    for i in range(len(a)):
        if a[i][0] == "." and a[i][1] >= 3:
            break
        if i == len(a)-1:
            print("No")
            sys.exit()
b = [[k, len(list(g))] for k, g in groupby(s[A-1:max(C, D)])]
for i in range(len(b)):
        if b[i][0] == "
            break
        if i == len(b)-1:
            print("Yes")
            sys.exit()
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):

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

ts = s[a-1:max(c,d)]
if (re.search(r"
    print("No")
    exit()


if (c > d):
    
    if (re.search(r"\.\.\.",s[b-1:d])):
        print("Yes")
    else :
        if ((s[b-2] == "
            print("No")
        else :
            print("Yes")
else:
    print("Yes")

Solution (Python):


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

is_ok = True

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

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

ans = "Yes" if is_ok else "No"

print(ans)

Solution (Python):
n, a, b, c, d = map(int, input().split())
S = input()
if S.find('
    print('No')
    exit()

if c > d:
    if S.find('...', b-2, d+1) == -1:
        print('No')
        exit()

print('Yes')

Solution (Python):
def solve(a, b, c, d, s):
    a -= 1
    b -= 1
    c -= 1
    d -= 1
    ss = s[a:c + 1]
    fs = s[b:d + 1]
    if '
        return False
    if '
        return False
    if c < d:
        return True
    fs2 = s[b - 1:d + 2]
    if '...' in ss and '...' in fs2:
        return True
    return False
 
 
n, a, b, c, d = list(map(int, input().split()))
s = input()
print('Yes' if solve(a, b, c, d, s) else 'No')