Problem:
 Score : 400 points    Problem Statement There are N squares arranged in a row, numbered 1, 2, ..., N from left to right.
You are given a string S of length N consisting of . and # . If the i -th character of S is # , Square i contains a rock; if the i -th character of S is . , Square i is empty.  In the beginning, Snuke stands on Square A , and Fnuke stands on Square B .  You can repeat the following operation any number of times:   Choose Snuke or Fnuke, and make him jump one or two squares to the right. The destination must be one of the squares, and it must not contain a rock or the other person.   You want to repeat this operation so that Snuke will stand on Square C and Fnuke will stand on Square D .  Determine whether this is possible.      Constraints  4 \leq N \leq 200\ 000  S is a string of length N consisting of . and # .  1 \leq A, B, C, D \leq N  Square A , B , C and D do not contain a rock.  A , B , C and D are all different.  A < B  A < C  B < D         Input Input is given from Standard Input in the following format:  N  A  B  C  D  S       Output Print Yes if the objective is achievable, and No if it is not.        Sample Input 1 7 1 3 6 7
.#..#..      Sample Output 1 Yes  The objective is achievable by, for example, moving the two persons as follows. ( A and B represent Snuke and Fnuke, respectively.)  A#B.#..

A#.B#..

.#AB#..

.#A.#B.

.#.A#B.

.#.A#.B

.#..#AB       Sample Input 2 7 1 3 7 6
.#..#..      Sample Output 2 No       Sample Input 3 15 1 3 15 13
...#.#...#.#...      Sample Output 3 Yes

Solution (Python):

 
import sys
import re
 
_,a,b,c,d = [ int(x)-1 for x in sys.stdin.readline().split() ]
m = sys.stdin.readline().strip()

if c>d:
    if m[b-1:d+2].find("...")<0:
        print( "No" )
        exit()
else:
    
    if m[b+1:d].find("
        print( "No" )
        exit()
    
    
    if m[a+1:c].find("
        print( "No" )
        exit()

print( "Yes" )

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):
import itertools as it
import collections as col
import heapq
import sys
sys.setrecursionlimit(10**9)

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

for i in range(A,C):
    if S[i] == '
        print('No')
        exit()

for i in range(B,D):
    if S[i] == '
        print('No')
        exit()

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

X=[-1]*N
X[B-1] = 0 if S[B-1] == '
for i in range(B,D+2):
    X[i] = 0 if S[i] == '
    if X[i] >= 3:
        print('Yes')
        exit()
print('No')

Solution (Python):
x = input().split()
s = input()
n = int(x[0])
a = int(x[1])
b = int(x[2])
c = int(x[3])
d = int(x[4])
 
 
kome_flag = False 
santen_flag = False 
 
a_s = s[a:c]
b_s = s[b:d]
 
 
if d < c:
  if '...' in s[b-2:d+1]:
    santen_flag = True
kome_flag = True
if '
  kome_flag = False
    

if True:
	if c < d:
		if kome_flag:
			print('Yes')
		else:
			print('No')
 
	if d < c:
		if kome_flag and santen_flag:
			print('Yes')
		else:
			print('No')

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

def max_stone(a, b):
  m = 0
  for j in range(a, b-1):
    if S[j] == S[j+1] == '
      return False
  
  return True
  
def reachable(b, d):
  n_sharp = 0
  n_dot = 0
  for j in range(b-1, d+2):
    s = S[j]
    if s=='.':
      n_dot += 1
      n_sharp = 0
    else:
      n_sharp += 1
      n_dot = 0
      
    if n_dot == 3:
      return True
    elif n_sharp == 2:
      return False
    
  return False
  
if C < B:
  if max_stone(A-1, C) and max_stone(B-1, D):
    print('Yes')
  else:
    print('No')
elif B < C and C < D:
  if max_stone(A-1, C) and max_stone(B-1, D):
    print('Yes')
  else:
    print('No')
elif B < C and C > D:
  if reachable(B-1, D-1) and max_stone(A-1, C) and max_stone(B-1, D):
    print('Yes')
  else:
    print('No')

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

def main():
    if "
        return "No"
    if "
        return "No"

    if c < d:
        return "Yes"
    
    else:

        if "..." in s[b-2:d+1]:
            return "Yes"
                
        return "No"

print(main())

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

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

s = input()

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

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

def max_stone(a, b):
  m = 0
  for j in range(a, b-1):
    if S[j] == S[j+1] == '
      return False
  
  return True
  
def reachable(b, d):
  n_sharp = 0
  n_dot = 0
  for j in range(b-1, d+2):
    s = S[j]
    if s=='.':
      n_dot += 1
      n_sharp = 0
    else:
      n_sharp += 1
      n_dot = 0
      
    if n_dot == 3:
      return True
    elif n_sharp == 2:
      return False
    
  return False
  
if C < B:
  if max_stone(A-1, C) and max_stone(B-1, D):
    print('Yes')
  else:
    print('No')
elif B < C and C < D:
  if max_stone(A-1, C) and max_stone(B-1, D):
    print('Yes')
  else:
    print('No')
elif B < C and C > D:
  if reachable(B-1, D-1) and max_stone(A-1, C) and max_stone(B-1, D):
    print('Yes')
  else:
    print('No')

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


def reachable(start, end):
    now = start
    while now <= end:
        nex = now
        while nex <= end and S[now] == S[nex]:
            nex += 1
        if S[now] == '
            return False
        now = nex
    return True


if not reachable(A, C) or not reachable(B, D):
    print("No")
    quit()

if C > D:
    can_over = False
    for i in range(B, D+1):
        if S[i-1] == S[i] == S[i+1] == ".":
            can_over = True
    if not can_over:
        print("No")
        quit()

print("Yes")

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

def max_stone(a, b):
  m = 0
  for j in range(a, b-1):
    if S[j] == S[j+1] == '
      return False
  
  return True
  
def reachable(b, d):
  n_sharp = 0
  n_dot = 0
  for j in range(b-1, d+2):
    s = S[j]
    if s=='.':
      n_dot += 1
      n_sharp = 0
    else:
      n_sharp += 1
      n_dot = 0
      
    if n_dot == 3:
      return True
    elif n_sharp == 2:
      return False
    
  return False

def reachable2(b, d):
  for k in range(b-1,d):
    if S[k] == S[k+1] == S[k+2] == ".":
      return True
  return False
  
if C < B:
  if max_stone(A-1, C) and max_stone(B-1, D):
    print('Yes')
  else:
    print('No')
elif B < C and C < D:
  if max_stone(A-1, C) and max_stone(B-1, D):
    print('Yes')
  else:
    print('No')
elif B < C and C > D:
  if reachable2(B-1, D-1) and max_stone(A-1, C) and max_stone(B-1, D):
    print('Yes')
  else:
    print('No')

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

def max_stone(a, b):
  m = 0
  for j in range(a, b-1):
    if S[j] == S[j+1] == '
      return False
  
  return True
  
def reachable(b, d):
  n_sharp = 0
  n_dot = 0
  for j in range(b-1, d+2):
    s = S[j]
    if s=='.':
      n_dot += 1
      n_sharp = 0
    else:
      n_sharp += 1
      n_dot = 0
      
    if n_dot == 3:
      return True
    
  return False

def reachable2(b, d):
  for k in range(b-1,d):
    if S[k] == S[k+1] == S[k+2] == ".":
      return True
  return False
  
if C < B:
  if max_stone(A-1, C) and max_stone(B-1, D):
    print('Yes')
  else:
    print('No')
elif B < C and C < D:
  if max_stone(A-1, C) and max_stone(B-1, D):
    print('Yes')
  else:
    print('No')
elif B < C and C > D:
  if reachable2(B-1, D-1) and max_stone(A-1, C) and max_stone(B-1, D):
    print('Yes')
  else:
    print('No')

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

def max_stone(a, b):
  m = 0
  for j in range(a, b-1):
    if S[j] == S[j+1] == '
      return False
  
  return True
  
def reachable(b, d):
  n_sharp = 0
  n_dot = 0
  for j in range(b-1, d+1):
    s = S[j]
    if s=='.':
      n_dot += 1
      n_sharp = 0
    else:
      n_sharp += 1
      n_dot = 0
      
    if n_dot == 3:
      return True
    elif n_sharp == 2:
      return False
    
  return False

def reachable2(b, d):
  for k in range(b-1,d):
    if S[k] == S[k+1] == S[k+2] == ".":
      return True
  return False
  
if C < B:
  if max_stone(A-1, C) and max_stone(B-1, D):
    print('Yes')
  else:
    print('No')
elif B < C and C < D:
  if max_stone(A-1, C) and max_stone(B-1, D):
    print('Yes')
  else:
    print('No')
elif B < C and C > D:
  if reachable2(B-1, D-1) and max_stone(A-1, C) and max_stone(B-1, D):
    print('Yes')
  else:
    print('No')

Solution (Python):
def main():
	n,a,b,c,d = map(int,input().split())
	a-=1
	b-=1
	c-=1
	d-=1
	s = input()
	if '
		print('No')
		return

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

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

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


print(ans)

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

s = input()

if c < d:
    for i in range(a,d-1):
        if s[i]==s[i+1]=='
            print('No')
            exit()
    print('Yes')
else:
    flag = False
    for i in range(a,c-1):
        if s[i]==s[i+1]=='
            print('No')
            exit()
    for i in range(b-1,d):
        if s[i]==s[i+1]==s[i+2]=='.':
            flag = True
            break
    if not flag:
        print('No')
        exit()
    print('Yes')

Solution (Python):
n, a, b, c, d = map(int, input().split())
s = list(input())
last = ""
for i in range(a, max(c, d)):
    if last == "
        print("No")
        exit()
    last = s[i]
flag = False
if c > d:
    s[b - 1] = "
    for i in range(a, c):
        if last == "
            flag = True
        last = s[i]
    s[b - 1] = "."
    count = 0
    for i in range(b - 1, d + 1):
        if s[i] == ".":
            count += 1
            if count == 3:
                flag = False
        else:
            count = 0
else:
    for i in range(b, d):
        if last == "
            flag = True
        last = s[i]
if not flag:
    print("Yes")
else:
    print("No")

Solution (Python):
N, A, B, C, D = [int(i) for i in input().split()]
S = input()

def solve():
    ac = S[A - 1:C]
    if A < B < D < C:
        bd = S[B - 2:D + 1]
        return ("
    else:
        bd = S[B - 1:D]
        return ("

if solve():
    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):
    ret = YES
    if '
        ret = NO
    else:
        if D < C:
            
            if not '...' in S[B - 2:D + 1]:
                ret = NO
    print(ret)
    return
 
 
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    A = int(next(tokens))  
    B = int(next(tokens))  
    C = int(next(tokens))  
    D = int(next(tokens))  
    S = next(tokens)  
    solve(N, A, B, C, D, S)
 
if __name__ == '__main__':
    main()

Solution (Python):



N,A,B,C,D = map(int,input().split())
S = input()
flag = 0
obs = []
esc = []
ans = 1


if A<B:
    low = A
    mid1 = B
else:
    low = B
    mid1 = A

if C<D:
    high = D
    mid2 = C
else:
    high = C
    mid2 = D



for i in range(low,high):
     if S[i]=="
         obs.append(i)
         flag = 0
     elif S[i] == "
         flag = 1
     else: flag = 0

 
flag = 0
for i in range(low,high):
      if S[i]=="." and flag == 2:
          esc.append(i)
          flag = 0
      elif S[i] == ".":
          flag += 1
      else:
          flag = 0

if len(obs)!=0:
    ans = 0

if D<C :
    flag = 0
    for i in range(len(esc)):
        if mid1<= esc[i] <= mid2:
            flag = 1
    if flag == 0:
        ans = 0


if ans==1:
    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):
    ret = YES
    if '
        ret = NO
    else:
        if D < C:
            
            if not '...' in S[B - 2:D + 1]:
                ret = NO
    print(ret)
    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 math
import numpy as np


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


def main():
    _, A, B, C, D = inputs()
    S = input()
    ans = []
    if '
        ans.append(False)
    else:
        ans.append(True)
    if '
        ans.append(False)
    else:
        ans.append(True)
    if D < C:
        if '...' in S[B-2: D+1]:
            ans.append(True)
        else:
            ans.append(False)

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


if __name__ == '__main__':
    main()

Solution (Python):
if __name__ == '__main__':
    N, A, B, C, D = map(int, input().split())
    S = str(input())
 
    answer = "-1"
 
    if C < D:
       if S[A:D:].count("
           answer = "No"
       else:
           answer = "Yes"
    else:
       if S[B-2:D+1:].count("...") >= 1:
           answer = "Yes"
       else:
           answer = "No"
 
    print(answer)

Solution (Python):
n, a, b, c, d = map(int, input().split())
s = list(input())
last = ""
for i in range(a, max(c, d)):
    if last == "
        print("No")
        exit()
    last = s[i]
flag = False
if c > d:
    s[b - 1] = "
    for i in range(a, c):
        if last == "
            flag = True
        last = s[i]
    s[b - 1] = "."
    count = 0
    for i in range(b - 1, d + 1):
        if s[i] == ".":
            count += 1
            if count == 3:
                flag = False
        else:
            count = 0
else:
    for i in range(b, d):
        if last == "
            flag = True
        last = s[i]
if not flag:
    print("Yes")
else:
    print("No")

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

if "
    print("No")
    exit()

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

Solution (Python):

import sys

YES = "Yes"  
NO = "No"  

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

    if '
        ret = NO
    else:
        if D < C:
            
            if '...' not in S[B - 2:D + 1]:
                ret = NO
    print(ret)
    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

YES = "Yes"  
NO = "No"  

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

    if '
        ret = NO
    else:
        if D < C:
            
            if not '...' in S[B - 2:D + 1]:
                ret = NO
    print(ret)
    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):
inputa = list(map(int, input().split()))
inputb = list(input())

mountain = 0
for i in range(min(inputa[1], inputa[2]) - 1, max(inputa[3], inputa[4])):
  if inputb[i] == "
    if mountain == 1:
      mountain = 2
      break
    mountain = 1
  else:
    mountain = 0

if mountain == 2:
  print("No")
  exit()
    

oikoshi = 0
if inputa[3] > inputa[4]:
  oikoshi = 1


triplestep = 0
for i in range(inputa[2] - 1, inputa[4]):
  if oikoshi == 0:
    break
  if inputb[i - 1] == ".":
    if inputb[i] == ".":
      if inputb[i + 1] == ".":
        triplestep = 1
        break

if oikoshi == 0:
  print("Yes")
else:
  if triplestep == 1:
    print("Yes")
  else:
    print("No")

Solution (Python):


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

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

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

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

Solution (Python):
n, a, b, c, d = map(int, input().split())
s = list(input())
last = ""
for i in range(a, c):
    if last == "
        print("No")
        exit()
    last = s[i]
last = ""
for i in range(b, d):
    if last == "
        print("No")
        exit()
    last = s[i]
last = ""
if c > d:
    flag = True
    s[b - 1] = "
    for i in range(a, c):
        if last == "
            flag = False
        last = s[i]
    s[b - 1] = "."
    count = 0
    for i in range(b - 1, d + 1):
        if s[i] == ".":
            count += 1
            if count == 3:
                flag = True
        else:
            count = 0
    if flag:
        print("Yes")
    else:
        print("No")
else:
    print("Yes")

Solution (Python):
n, a, b, c, d = list(map (int, input().split()))
s = input ()
s = '
 
ans = True
 
if '
    ans = False
else:
    if d < c:
        ans = False
        if '...' in s[b-1:d+2]:
            ans = True
        
 
if ans is True:
    print ('Yes')
else:
    print ('No')

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

Solution (Python):

"""
Created on Sun Jun  2 22:01:55 2019

@author: hisaki
"""

import sys
N, A, B, C, D = map(int, input().split())
S = input()
A_start = A -1
B_start = B -1
A_goal = C -1
B_goal = D -1

A_pos = A_start
B_pos = B_start

flag = True
for i in range(A_pos, A_goal):
    if S[i] == '
        if S[i+1] == '
            flag = False

for i in range(B_pos, B_goal):
    if S[i] == '
        if S[i+1] == '
            flag = False
            
if flag == False:
    print ("No")
    sys.exit()
  


if A_goal < B_goal:
    print ("Yes")
    sys.exit()


if B_goal < A_goal :
    for i in range(B_pos , B_goal+1):
        if (S[i-1] == '.' or i-1 == A_pos) and (S[i]== '.') and (S[i+1] == '.'):
            print ("Yes")
            sys.exit()

            
print ("No")

Solution (Python):









def searchRock(in_l, in_r, in_str, in_tg):
    rcflg = False
    for i in range(in_l - 1, in_r - 1): 
        if in_str[i] == in_tg and in_str[i+1] == in_tg:
            rcflg = True
            break
    return rcflg

def searchPlain(in_l, in_r, in_str, in_tg):
    rcflg = False
    for i in range(in_l - 1, in_r - 1): 
        if in_str[i] == in_tg and in_str[i+1] == in_tg and in_str[i+2] == in_tg:
            rcflg = True
            break
    return rcflg


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


if c < b:
    
    rflg = searchRock(a, c+1, s, "
    if rflg == True:
        ans = "No"
    else:
        rflg = searchRock(b, d+1, s, "
        if rflg == True:
            ans = "No"

else:
    
    rflg = searchRock(a, max(c, d)+1, s, "
    if rflg == True:
        ans = "No"
    

if ans != "No":
    if (b < c and d < c):
        
        pflg = searchPlain(b-1, d, s, ".")
        if pflg == False:
            ans = "No"




        else:
            ans = "Yes"
    else:
        ans = "Yes"


print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
MOD = 1000000007
def POW(x, y): return pow(x, y, MOD)
def INV(x, m=MOD): return pow(x, m - 2, m)
def DIV(x, y, m=MOD): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())
def SI(): return input()

N,A,B,C,D=LI()
st=input()

if C < D:
    if st[A:C].find('
        print('No')
    else:
        print('Yes')
else:
    
    if st.find('
        print('No')
    else:
        fnd = st.find('...', B-2, D+1)
        if fnd >= 0:
            print('Yes')
        else:
            print('No')

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

else:
  for i in range(a,c):
    if s[i] == s[i+1] == "
      check = 0
      break
  if check:
    check = 0
    for i in range(b, d+1):
      if s[i-1] == s[i] == s[i+1] == ".":
        check = 1
        break


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

Solution (Python):






N, A, B, C, D = map(int, input().split())
S = input()
"""
7 1 3 7 6
.
"""





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

"""
if C<D: 
    shc = 0
    for s in S[A-1:C]:
        if shc > 1:
            ans = 'No'
            break
        if s == '
            shc += 1
        if s == '.':
            shc = 0
    shc = 0
    for s in S[B-1:D]:
        if shc > 1:
            ans = 'No'
            break
        if s == '
            shc += 1
        if s == '.':
            shc = 0
elif C>D: 
    
    shc = 0
    dc = 0
    mdc = 0
    for i, s in enumerate(S[A-1:C]): 
        if shc > 1:
            ans = 'No'
            break
        if s == '
            shc += 1
            if dc>0:
                mdc = max(dc, mdc)
                dc = 0
        if s == '.':
            dc += 1
            shc = 0
        if i >= C-A:
            mdc = max(dc, mdc)
    if mdc >= 3:
        
        pass
    elif mdc < 3: 
        
        shc = 0
        for i, s in enumerate(S[0:A:-1]):
            if shc >1:
                l = A-i+1
                break
            if s == '
                shc += 1
            if s == '.':
                shc = 0
            if i >= A-1 and shc > 1:
                l = A-i+2
        else:
            l = 0
            
        shc = 0
        for i, s in enumerate(S[C:]):
            if shc >1:
                r = C+i-2
                break
            if s == '
                shc += 1
            if s == '.':
                shc = 0
            if i >= N-C-1 and shc > 1:
                r = C+i-2
        else:
            r = N
        
        
        mdc = 0
        dc = 0
        for i, s in enumerate(S[l:r]):
            
            if s == '
                if dc>0:
                    mdc = max(dc, mdc)
                    dc = 0
            if s == '.':
                dc += 1
            if i >= r-l-1:
                mdc = max(dc, mdc)
        if mdc < 3:
            ans = 'No'
print(ans)
"""

Solution (Python):
n, a, b, c, d = map(int, input().split())
s = list(input())
last = ""
for i in range(a, c):
    if last == "
        print("No")
        exit()
    last = s[i]
last = ""
for i in range(b, d):
    if last == "
        print("No")
        exit()
    last = s[i]
last = ""
if c > d:
    flag = True
    s[b - 1] = "
    for i in range(a, c):
        if last == "
            flag = False
        last = s[i]
    s[b - 1] = "."
    count = 0
    for i in range(b - 1, d+1):
        if s[i] == ".":
            count += 1
            if count == 3:
                flag = True
        else:
            count = 0
    if flag:
        print("Yes")
    else:
        print("No")
else:
    print("Yes")

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

s_cnt = 0
max_s_cnt = 0
pre_s = ''

goal = max(C, D)

if C < B:
  for i in range(A-1, C):
    if pre_s == "
      if S[i] == "
        print("No")
        exit()
    pre_s = S[i]
  for i in range(B-1, D):
    if pre_s == "
      if S[i] == "
        print("No")
        exit()
    pre_s = S[i]
  print("Yes")
  exit()

for i in range(A-1, goal):
  if pre_s == "
    if S[i] == "
      print("No")
      exit()
  if i >= B - 2 and i < D + 1:
    if S[i] == '.':
      s_cnt += 1
      if max_s_cnt < s_cnt:
        max_s_cnt = s_cnt
    else:
      s_cnt = 0
  pre_s = S[i]

  
if C < D:
  print("Yes")
else:
  if max_s_cnt >= 3:
    print("Yes")
  else:
    print("No")

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

    
    
    
    

    answer = "-1"

    if C < D:
       if S[A:D:].count("
           answer = "No"
       else:
           answer = "Yes"
    else:
       if S[B-2:D+1:].count("...") >= 1:
           answer = "Yes"
       else:
           answer = "No"

    print(answer)

Solution (Python):
class KenkenRace:
    def __init__(self):
        N, A, B, C, D = map(int, input().split())
        S = [str(c) for c in input()]

        self.N = N
        self.A = A
        self.B = B
        self.C = C
        self.D = D
        self.S = S

    def main(self):
        result = False

        
        if self.C < self.D:
            
            result = self.__canClear(self.A, self.C) and self.__canClear(self.B, self.D)

        
        else:
            
            result = self.__canClear(self.A, self.C) and self.__canClear(self.B, self.D) and self.__canOvertake()

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

    def __canClear(self, start, end):
        isDouble = False
        preObject = ""

        for i in range(start - 1, end):
            c = self.S[i]
            if c == "
                isDouble = True
                break
            else:
                preObject = c

        return not isDouble

    def __canOvertake(self):
        isTriple = False
        objectCount = 0
        severalCount = 0

        
        if self.S[self.B - 2] == "." and self.S[self.B] == ".":
            return True

        if self.S[self.B] == "." and self.S[self.B + 1] == ".":
            return True

        
        if self.S[self.D - 2] == "." and self.S[self.D] == ".":
            return True

        for i in range(self.B - 1, self.D):
            c = self.S[i]
            objectCount += 1

            
            if c == ".":
                severalCount += 1
            else:
                severalCount = 0

            
            if severalCount == 3:
                isTriple = True
                break

        return isTriple


kenkenRace = KenkenRace()
kenkenRace.main()

Solution (Python):
import sys
sys.setrecursionlimit(10**6)

N, A, B, C, D = map(int, input().split())
S = list(input())
S[A-1] = '
S.extend(['
def dfs(a = A, b = B):
    if a == C and b == D:
        return 'Yes'

    if S[a] == '.' and a != C:
        S[a] = '
        return dfs(a+1, b)
    if S[a+1] == '.' and a != C:
        S[a+1] = '
        return dfs(a+2, b)
    if S[b] == '.' and b != D:
        S[b] = '
        return dfs(a, b+1)
    if S[b+1] == '.' and b != D:
        S[b+1] = '
        return dfs(a, b+2)
    return 'No'
print(dfs())

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

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

S = input()

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

Solution (Python):

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

if d < c:
    f = False
    for i in range(n)[b:d + 1]:
        if '...' in s[i - 1:i + 2]:
            f = True
    if not f:
        print('No')
        exit()
    a, b = b, a
    c, d = d, c
print(['Yes', 'No']['

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

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

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

if c>d:
    flg=True
    if s[b-2:d+1].count('...')>0:
        flg=False
    if flg:
        print('No')
        exit()

if s[a:c].count('
    print('No')
    exit()

print('Yes')

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

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

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

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