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 math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') 
def gcd(a,b):return fractions.gcd(a,b) 
def lcm(a,b):return (a*b) // fractions.gcd(a,b) 
def iin(): return int(sys.stdin.readline()) 
def ifn(): return float(sys.stdin.readline()) 
def isn(): return sys.stdin.readline().split() 
def imn(): return map(int, sys.stdin.readline().split()) 
def imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) 
def fmn(): return map(float, sys.stdin.readline().split()) 
def iln(): return list(map(int, sys.stdin.readline().split())) 
def iln_s(): return sorted(iln()) 
def iln_r(): return sorted(iln(), reverse=True) 
def fln(): return list(map(float, sys.stdin.readline().split())) 
def join(l, s=''): return s.join(l) 
def perm(l, n): return itertools.permutations(l, n) 
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) 
def comb(l, n): return itertools.combinations(l, n) 
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) 
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 
def m_add(a,b): return (a+b) % MOD
def print_list(l): print(*l, sep='\n')
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def No(): print('No')

def sieves_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime

N,A,B,C,D = imn()
S = list(input())

def can_reach(a, b):
    reachable = True
    for i in range(a-1, b-1):
        if S[i] != '
        reachable = False
    return reachable

def takeoverable(a, b):
    cantakeover = False
    for i in range(a-2, b-1):
        if S[i] == '
        cantakeover = True
    return cantakeover

ans = True
if C == D:
    ans = False
if not can_reach(A, C) or not can_reach(B, D):
    ans = False
if C > D:
   if not takeoverable(B,D):
       ans = False
print('Yes' if ans else 'No')

Solution (Python):
def count_section_by_zero(data):
  count = 0
  flg = False
  start = 0
  for i, d in enumerate(data):
    if flg is False and d != 0:
      count += 1
      flg = True
      
    if d == 0:
      flg = False
  return count

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

def input_list_str():
  return list(map(str, input().split()))

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


def divide_two(arg):
  c = 0
  while True:
    if c >= 2:
      break
    if arg % 2 != 0:
      break
    arg //= 2
    c += 1
  return c


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def main():
  n, a, b, c, d = input_list()
  s = input()
  dp = []
  has_space = False
  if s[c-1] == '
    print('No')
    exit(0)
  if s[d-1] == '
    print('No')
    exit(0)
  if c < d:
    for i in range(a-1, c):
      if s[i] == '
        print('No')
        exit(0)
    for i in range(b-1, d):
      if s[i] == '
        print('No')
        exit(0)
  else:
    for i in range(a-1, c):
      if s[i] == '
        print('No')
        exit(0)
     
    for i in range(b-1, d):
      if s[i] == '
        print('No')
        exit(0)
      if s[i-1] == '.' and s[i+1] == '.' and s[i] == '.':
        has_space = True
    if has_space is False:
      print('No')
      exit(0)

  print('Yes')
  
import math
import fractions
import collections
import itertools
from functools import reduce
main()

Solution (Python):
import sys
n, a, b, c, d = map(int, sys.stdin.readline().split())
s = sys.stdin.readline().rstrip()

def can_reach(start, end):
    for i in range(start, end):
        if s[i] == '
            return False
    return True

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

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



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

elif c == d:
    print("No")

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-1, d):
        if s[i:i+3] == "...":
            print("Yes")
            exit()
    print("No")

Solution (Python):



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


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

Solution (Python):
import sys
n, a, b, c, d = map(int, sys.stdin.readline().split())
s = sys.stdin.readline().rstrip()

def can_reach(start, end):
    for i in range(start-1, end-1):
        if s[i] == '
            return False
    return True

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

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

Solution (Python):

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


S = input()
if S[A:C+1].count('
    print('No')
    exit(0)

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

print('Yes')

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

for i in range(a, max(c, d)):
    if s[i] == '
        print('No')
        exit()

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

Solution (Python):
n, a, b, c, d = map(int, input().split())
s = list(input())
a -= 1
b -= 1
c -= 1
d -= 1
jump = True
if d < c:
    cnt = 0
    for i in range(b-1,d+2):
        if s[i] == '.':
            cnt += 1
        if cnt == 3:
            break
        if s[i] == '
            cnt = 0
    else:
        jump = False
cnt = 0
for i in range(a,c):
    if s[i] == '
        cnt += 1
    if s[i] == '.':
        cnt = 0
    if cnt == 2:
        jump = False
        break
for i in range(b,d):
    if s[i] == '
        cnt += 1
    if s[i] == '.':
        cnt = 0
    if cnt == 2:
        jump = False
        break
if jump:
    print('Yes')
else:
    print('No')

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N, A, B, C, D = [int(x) for x in input().split()]
    S = input().strip()

    def rock_check(start, end):
        for a, b in zip(S[start:end], S[start + 1:end]):
            if a == b == "
                return False
        else:
            return True

    def three_space_check(start, end):
        start -= 2
        end += 1
        for a, b, c in zip(S[start:end], S[start + 1:end], S[start + 2:end]):
            if a == b == c == ".":
                return True
        else:
            return False

    bfirst = False
    if C < D:
        bfirst = True

    if bfirst:
        if A > B:
            if rock_check(B, D) and rock_check(A, C) and three_space_check(A, C):
                print("Yes")
            else:
                print("No")
        else:
            if rock_check(B, D) and rock_check(A, C):
                print("Yes")
            else:
                print("No")
    else:
        if B > A:
            if rock_check(B, D) and rock_check(A, C) and three_space_check(B, D):
                print("Yes")
            else:
                print("No")
        else:
            if rock_check(B, D) and rock_check(A, C):
                print("Yes")
            else:
                print("No")


if __name__ == '__main__':
    main()

Solution (Python):
def main():
    length, snuke_start, hnuke_start, snuke_goal, hnuke_goal = map(lambda x: int(x) - 1, input().split())
    grid = input()
    is_rock_continuing = False
    is_space_continuing = False
    if "
        is_rock_continuing = True
    if "..." in grid[hnuke_start - 1:hnuke_goal + 2]:
        is_space_continuing = True
    if snuke_goal < hnuke_goal and not is_rock_continuing:
        print("Yes")
    elif hnuke_goal < snuke_goal and not is_rock_continuing and is_space_continuing:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

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

def dp(s,g):
  if s==g or s==g-1 or s==g-2:
    return 1
  if S[s+1]=='.' and S[s+2]=='.':
    return DP[s+1]|DP[s+2]
  if S[s+1]=='
    return DP[s+2]
  if S[s+1]=='.' and S[s+2]=='
    return DP[s+1]
  if S[s+1]=='
    return 0
DP=[0]*(N+1)
for i in range(C,A-1,-1):
  DP[i] = dp(i,C)
ansA = DP[A]
for i in range(D,B-1,-1):
  DP[i] = dp(i,D)
ansB = DP[B]

if C<D:
  ans = ansA & ansB
else:
  ans = ansA & ansB & ('...' in S[B-1:D+2])

Ans = ['No','Yes']
print(Ans[ans])

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

S = '.' + input() + '


if '
    print('No')
    exit()



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

        print('No')
        exit()

print('Yes')

Solution (Python):

import sys
import heapq

YES = "Yes"  
NO = "No"  

def isBlock(S,i):
    return S[i] == "

def hasContinuingSharp(S,A,B):
    prevSharp = False
    for i in range(A,B):
        if isBlock(S,i):
            if prevSharp:
                return True
            else:
                prevSharp = True
        else:
            prevSharp = False
    return False

def hasThreeContinueingNonSharp(S,A,B):
    nonBlockCount = 0
    for i in range(A,B):
        if isBlock(S,i):
            nonBlockCount = 0
        else:
            nonBlockCount += 1
            if nonBlockCount == 3:
                return True
    return False

def solve(N: int, A: int, B: int, C: int, D: int, S: str):
    A-=1
    B-=1
    C-=1
    D-=1
    if hasContinuingSharp(S,A,C) or hasContinuingSharp(S,B,D):
        print(NO)
        return
    if C < D:
        print(YES)
        return
    if hasThreeContinueingNonSharp(S,B-1,D+2):
        print(YES)
    else:
        print(NO)
    return



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

if __name__ == '__main__':
    main()

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

answer="Yes"


if "
    answer="No"
if C<D:
    pass
else:
    if "..." not in S[B-2:D+1]:
        answer="No"
    
print(answer)

Solution (Python):
def main():
    N, A, B, C, D = (int(i) for i in input().split())
    S = "
    if "
        return print("No")
    if D < C and "..." not in S[B-1:D+2]:
        return print("No")
    print("Yes")


if __name__ == '__main__':
    main()

Solution (Python):
def main():
    N, A, B, C, D = (int(i) for i in input().split())
    S = input()
    if "
        return print("No")
    if D < C and (S[D-2] == "
        if (S[B-2] == "
            return print("No")
    print("Yes")


if __name__ == '__main__':
    main()

Solution (Python):
N, A, B, C, D = map(int, input().split())
S = input()
p = 0
t = 0
stri = 0
for i in range(A-1, max(C, D) - 1):
  if S[i:i+2] == '
    p = 1
for j in range(B-1, min(C, D) - 1):  
  if S[j:j+3] == '...':
    if stri == 0:
      stri = j + 1
    t = 1
if S[B] == '.' and S[B-2] == '.':
  t = 1
if (C < D and p == 0) or (C > D and p == 0 and t == 1 and stri <= D-1):
  print('Yes')
else:
  print('No')

Solution (Python):
N, A, B, C, D = map(int, input().split())
S = input()
p = 0
t = 0
sti = 0
for i in range(A-1, max(C, D) - 1):
  if S[i:i+2] == '
    p = 1
for j in range(B-1, min(C, D) - 1):  
  if S[j:j+3] == '...':
    if sti == 0:
      sti = j + 1
    t = 1
if S[B] == '.' and S[B-2] == '.':
  t = 1
if (C < D and p == 0) or (C > D and p == 0 and t == 1 and sti <= D-1):
  print('Yes')
else:
  print('No')

Solution (Python):
from copy import deepcopy
def solve():
    N,A,B,C,D = map(lambda x:int(x)-1, input().split())
    field_orig = list(input())
    field = deepcopy(field_orig)

    if C < D:
        if existsContinuousRocks(field,A,B,C,D):
            print('No')
        else:
            print('Yes')
    else:
        if not existsContinuousRocks(field,A,B,C,D) \
            and existsContinuousDots(field,A,B,C,D):
            print('Yes')
        else:
            print('No')

def existsContinuousRocks(field, A, B, C, D):
    for i in range(A, min(max(C,D), len(field)-1)):
        if field[i] == '
            return True
    return False

def existsContinuousDots(field,A,B,C,D):
    for i in range(B-1,min(D, len(field)-2)):
        if field[i] == '.' and field[i+1] == '.' and field[i+2] == '.':
            return True
    return False


if __name__ == '__main__':
    solve()

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

Sarr = [True if s == '.' else False for s in S]


def canmove(st):
  global N, Sarr
  can = [False] * N
  can[st-1] = True
  for i in range(st, N):
    if Sarr[i]:
      if can[i-1] or can[i-2]:
        can[i] = True
  return can

Acan = canmove(A)
Bcan = canmove(B)



ans = Acan[C-1] and Bcan[D-1]


def canpass(st, ed):
  global Sarr
  for i in range(st, ed-1):
    if Sarr[i] and Sarr[i+1] and Sarr[i+2]:
      return True
  return False

if C > D:
  ans = ans and canpass(B-2, D)


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

Solution (Python):





import itertools



import sys



ipti = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)

def main():
    n, a, b, c, d = list(map(int,ipti().split()))
    a -= 1
    b -= 1
    c -= 1
    d -= 1

    s = input()

    if c > d:
        s_groupby = itertools.groupby(s[b-1:d+2])
        for key, group in s_groupby:
            group_list = list(group)
            if key == "." and len(group_list) >= 3:
                break
        else:
            print('No')
            sys.exit()

    for i in range(a + 1, d):
        if s[i] == "
            if s[i + 1] == "
                print('No')
                sys.exit()

    print('Yes')

if __name__ == '__main__':
    main()

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

long_s = s[a-1:max(c,d)]
short_s = s[b-2:min(c,d)+1]
rocks = long_s.count("
change = short_s.count("...")

if rocks >= 1:
  print("No")
elif c > d and change == 0:
  print("No")
else:
  print("Yes")

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

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

right_end = max(C, D)
S = S[A:right_end+1]

ans = True
if A < B < C < D:
    if S.count('
        ans = False
elif A < C < B < D:
    if S[A:C+1].count('
        ans = False
else:
    if S.count('
        ans = False
    elif S[B:D+2].count('...'):
        pass
    elif S[B-1:B+2] == '...':
        pass
    else:
        ans = False

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

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

flg = '
if C > D and not flg:
  f,e = max(A-1,B-2),min(D+1,N)

  flg = not '...' in S[f:e]
print("No" if flg else "Yes")

Solution (Python):
def main():
    n, a, b, c, d = map(int, input().split())
    s = input()
    r = 'Yes'
    if ('
        r = 'No'
    else:
        if (c>d) and not ('...' in s[b-2:d+1]):
            r = 'No'
    print(r)

main()

Solution (Python):

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

if c<d:
    btod=s[b:d]
    atoc=s[a:c]
    if btod.count("
    if atoc.count("
else:
    btod=s[b-1-1:d+1]
    atoc=s[a:c]
    if atoc.count("
    else:
        if btod.count("...")==0:ans="No"
    
print(ans)

Solution (Python):
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7

n,a,b,c,d=map(int,input().split())
s=input()
for i in range(b-1,d-1):
    if s[i]=="
        print("No")
        quit()

if c<d:
    for i in range(a-1,c-1):
        
        if s[i]=="
            print("No")
            quit()

else:
    flag=0
    for i in range(b-2,d-1):
        
        if s[i]=="." and s[i+1]=="." and s[i+2]==".":
            flag=1
    if flag==0:
        print("No")
        quit()
    for i in range(a-1,c-1):
        if s[i]=="
            print("No")
            quit()
print("Yes")

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

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

main()

Solution (Python):
def reach(s, x, y):
    for i in range(x, y-1):
        if s[i] == "
            return False
    return True
def search(s, x, y):
    for i in range(x-1, y):
        if s[i] == "." and s[i+1] == "." and s[i+2] == ".":
            return True
        if s[i] == "
            break
    return False

def main():
    n, a, b, c, d = map(int, input().split())
    a -= 1
    b -= 1
    c -= 1
    d -= 1
    s = input().rstrip()
    if reach(s, a, c) and reach(s, b, d):
        if c < d:
            print("Yes")
        else:
            if search(s, b, d):
                print("Yes")
            else:
                print("No")

    else:
        print("No")

if __name__ == "__main__":
    main()

Solution (Python):
N,A,B,C,D=map(int,input().split())
S=input()
E=min(C,D)
F=max(C,D)
if S.find('
  print('No')
else:
  if C<D:
    print('Yes')
  else:
    if S.find('...',B-2,E+1)>0:
      print('Yes')
    else:
      print('No')

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

s = input()

if s.find('
    if c<d :
        print('Yes')
    else :
        if s.find('...',b-2,d+1)>=0:
            print('Yes')
        else :
            print('No')
else :
    print('No')

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

s = input()

if s.find('
    if c<d :
        print('Yes')
    else :
        if s.find('...',b-2,d+1)>=0:
            print('Yes')
        else :
            print('No')
else :
    print('No')

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

s = input()

if s.find('
    if c<d :
        print('Yes')
    else :
        if s.find('...',b-2,d+1)>=0:
            print('Yes')
        else :
            print('No')
else :
    print('No')

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

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

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

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

for i in range(1,n-1):
    if s[i-1:i+1]=="
        if a<i<c or b<i<d:
            ans=2
            break
    if s[i-1:i+2]=="...":
        jump.append(i)

if ans!=2:
    if c<d:
        ans=0
    else:
        for i in jump:
            if b<=i<=d:
                ans=0
                break

print("Yes" if ans==0 else "No")

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

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

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

if C < D:
    if '
        print('No')
    else:
        print('Yes')
else:
    if '...' 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 S.find("
    if C<D:
        print("Yes")
    else:
        if S.find("...", B-2, D+1)>=0:
            print("Yes")
        else:
            print("No")
else:
    print("No")

Solution (Python):
N, A, B, C, D = map(int, input().split())
S = input()
if C < D:
    Aok = "
    Bok = "
    if Aok and Bok:
        print("Yes")
    else:
        print("No")
else:
    Aok = "
    Bok = "
    jumpok = "..." in S[B-2:D+1]
    if Aok and Bok and jumpok:
        print("Yes")
    else:
        print("No")

Solution (Python):
N, A, B, C, D = map(int, input().split())
S = input()
if C < D:
    Aok = "
    Bok = "
    if Aok and Bok:
        print("Yes")
    else:
        print("No")
else:
    Aok = "
    Bok = "
    jumpok = "..." in S[B-2:D+1]
    if Aok and Bok and jumpok:
        print("Yes")
    else:
        print("No")

Solution (Python):
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda x: [ni() for _ in range(x)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda x: [na() for _ in range(x)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda x: [ns() for _ in range(x)]
nas = lambda: stdin.readline().split()

n, a, b, c, d = na()
a -= 1
b -= 1
c -= 1
d -= 1
s = ns()

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

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

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

if c > d:
	if "..." not in s[max(0,b-2):min(d+1,n)]:
		print ("No")
		exit()
print ("Yes")

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

if ("
  F  =False




if C > D and ("..." not in S[B-1-1:D+1]): 
    F = False


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

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



flag = True

if '
    flag = False

if '
    flag = False


if C > D:
    if '...' not in S[B-2:D+1]:
    
        flag = False

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

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

Solution (Python):
import re
n, a, b, c, d = map(int, input().split())
s = input()
for i in range(a-1, c-1):
  if s[i] + s[i+1] == "
    print("No")
    exit()
for i in range(b-1, d-1):
  if s[i] + s[i+1] == "
    print("No")
    exit()
if c < d:
  print("Yes")
else:
  f = False
  for i in range(b-2, min(d-1, n-2)):
    if s[i] + s[i+1] + s[i+2] == "...":
      f = True
  if f:
    print("Yes")
  else:
    print("No")

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

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

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

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

Solution (Python):
N,A,B,C,D = map(int,input().split())
S = str(input())
E = max(C,D)
AE = S[A:E]
BD = S[B-2:D+1]
if "
  print("No")
elif C > D and "..." not in BD:
  print("No")
else:
  print("Yes")

Solution (Python):
import sys


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

if __name__ == "__main__":
    main()

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

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

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n,a,b,c,d = inpl()
s = input()
def chk(i):
    if s[i] == s[i+1] == '
        print('No')
        quit()
    return True
def cc(i):
    if s[i] == s[i+1] == s[i+2] == '.':
        return True
    return False

if c < d:
    for i in range(b-1,d-1):
        chk(i)
    for i in range(a-1,c-1):
        chk(i)
else:
    for i in range(b-2,d-1):
        if cc(i):
            break
    else:
        print('No')
        quit()
    for i in range(a-1,c-1):
        chk(i)
print('Yes')

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

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

    t = ''
    for i in range(len(s)):
        if i == d-1:
            t += '
        else:
            t += s[i]

    for i in range(a-1, c-1):
        if t[i] == '
            print('No')
            exit()

    print('Yes')
elif c > d:
    for i in range(a-1, c-1):
        if s[i] == '
            print('No')
            exit()

    for bi in range(b-1,d):
        if s[bi-1] == s[bi] == s[bi+1] == '.':
            print('Yes')
            exit()

    print('No')

else:
    print('No')

Solution (Python):
from sys import stdin

n,a,b,c,d = [int(x) for x in stdin.readline().rstrip().split()]
s = ["."]+list(stdin.readline().rstrip())
for i in range(b,d):
    if s[i] == "
        print("No")
        exit()
for j in range(a,c):
    if s[j] == "
        print("No")
        exit()
if c < d:
    print("Yes")
    exit()
for k in range(b,d+1):
    if s[k-1] == "." and s[k] == "." and s[k+1] == ".":
        print("Yes")
        exit()
print("No")

Solution (Python):
N,Sa,Sb,Ga,Gb = map(int, input().split())
S = input()

Sa-=1
Sb-=1
Ga-=1
Gb-=1

for i in range(Sa,Ga):
    if S[i] == "
        print("No")
        exit()
for i in range(Sb,Gb):
    if S[i] == "
        print("No")
        exit()

if Gb < Ga: 

    for i in range(Sb-1,Gb):
        if S[i] == "." and S[i+1] == "." and S[i+2] == "." :
            print("Yes")
            exit()

    print("No")

else: 
    print("Yes")