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

A#.B#..

.#AB#..

.#A.#B.

.#.A#B.

.#.A#.B

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

Solution (Python):
n, a, b, c, d = map(int, input().split())
a -= 1
b -= 1
c -= 1
d -= 1
s = input()
if a < b < d < c:
    ok = True
    for i in range(a, c):
        if s[i] == '
            ok = False
            break

    ok2 = True
    for i in range(b, d):
        if s[i] == '
            ok2 = False
            break

    ok3 = False
    for i in range(b, d+1):
        if s[i-1] == '.' and s[i] == '.' and s[i+1] == '.':
            ok3 = True
            break

    if ok and ok2 and ok3:
        print('Yes')
    else:
        print('No')
else:
    ok = True
    for i in range(a, c):
        if s[i] == '
            ok = False
            break

    ok2 = True
    for i in range(b, d):
        if s[i] == '
            ok2 = False
            break

    if ok and ok2:
        print('Yes')
    else:
        print('No')

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())
s = input()
s = '.' + s
if '
    print('No')
else:
    print('Yes')

Solution (Python):
def solve():
    n, a, b, c, d = map(int, input().split())
    s = input()
    if c<d:
        for i in range(a-1, d-1):
            if s[i]=='
                return False
        if s[c-1]=='
            return False
        return True
    elif c==d:
        return False
    else:
        flag = False
        for i in range(a-1, c-1):
            if s[i]=='
                return False
            if s[i-1]=='.' and s[i]=='.' and s[i+1]=='.' and b-1<=i<=d-1:
                flag = True
        if s[c-1]=='
            return False
        if not flag:
            return False
    return True
if solve():
    print('Yes')
else:
    print('No')

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

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

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

Solution (Python):



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

def check(x,y):
    ok = 1
    num = 0
    for moji in s[x:y]:
        if moji == "
            num+=1
        else:
            num = 0
        if num >= 2:
            ok = 0
            break
    return ok

def check3(x,y):
    ok = 0
    num = 0


    for moji in s[x-1:y+2]:
        if moji == ".":
            num+=1
        else:
            num = 0
        if num >= 3:
            ok = 1
            break
    return ok


if c < d:
    if check(a,c) and check(b,d):
        print("Yes")
    else:
        print("No")

else:
    if check3(b,d) and check(a,c):
        print("Yes")
    else:
        print("No")

Solution (Python):
import sys

def InputToInt():
    A = input().split()
    for i in range(len(A)):
        A[i] = int(A[i])
    return A


def Yes():
    print('Yes')
    sys.exit()


def No():
    print('No')
    sys.exit()


if __name__ == '__main__':
    N, A, B, C, D = InputToInt()
    L = input()
    if D > C:
        for i in range(A, D-2):
            if L[i:i+2] == '
                No()
        Yes()

    if D < C:
        for i in range(A, C-2):
            if L[i:i+2] == '
                No()
        if '...' in L[B-2:D+1]:
            Yes()
        else:
            No()

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

front = min(a, b, c, d)
back = max(a, b, c, d)
for i in range(front, back):
    if s[i] == "
        print("No")
        exit()
if d > c:
    print("Yes")
    exit()
state = "No"
if d < c:
    for i in range(b, d+1):
        if s[i-1] == "." and s[i] == "." and s[i+1] == ".":
            state = "Yes"
            break
print(state)

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

double=[]
for i in range(0,N-1):
    if(S[i]=='
        double.append(i)

for i in range(0,len(double)):
    if(A<double[i] and double[i]<C):
        print("No")
        sys.exit()
    elif(B<double[i] and double[i]<D):
        print("No")
        sys.exit()


if((B-A)*(D-C)>0):
    print("Yes")
    sys.exit()


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

if(tri):
    print("Yes")
    sys.exit()
else:
    print("No")
    sys.exit()

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:
    print('Yes')
    exit()
if '...' in s[b-1:d+2]:
    print('Yes')
else:
    print('No')

Solution (Python):




def main():
  _, s_s, f_s, s_e, f_e = map(int, input().split())
  n = input().strip()

  s_s = s_s - 1
  s_e = s_e - 1
  f_s = f_s - 1
  f_e = f_e - 1

  if '
    print('No')
  elif s_e < f_e:
    print('Yes')
  elif '...' in n[f_s - 1:f_e + 2]:
    print('Yes')
  else:
    print('No')


if __name__ == '__main__':
  main()

Solution (Python):
import sys

def main():
    input = sys.stdin.readline
    N, A, B, C, D = map(int, input().split())
    S = input().strip()
    S = S[A-1:max(C, D)]

    if '
        return 'No'

    if D > C:
        return 'Yes'

    if '...' in S[B-2:D+1]:
        return 'Yes'

    return 'No'


if __name__ == '__main__':
    print(main())

Solution (Python):

from __future__ import division, print_function

import os
import sys
from __builtin__ import xrange as range
from cStringIO import StringIO
from future_builtins import ascii, filter, hex, map, oct, zip
from io import IOBase

import __pypy__


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

    for i in range(a - 1, c - 1):
        if s[i + 1] == s[i] == '
            print('No')
            return

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

    if d > c:
        print('Yes')
        return

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

    print('No')
    return




BUFSIZE = 8192


class FastI(IOBase):
    def __init__(self, file):
        self._fd = file.fileno()
        self._buffer = StringIO()
        self.newlines = 0

    def read(self):
        if self._buffer.tell():
            return self._buffer.read()
        return os.read(self._fd, os.fstat(self._fd).st_size)

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count("\n") + (not b)
            ptr = self._buffer.tell()
            self._buffer.seek(0, 2), self._buffer.write(b), self._buffer.seek(ptr)
        self.newlines -= 1
        return self._buffer.readline()


class FastO(IOBase):
    def __init__(self, file):
        self._fd = file.fileno()
        self._buffer = __pypy__.builders.StringBuilder()
        self.write = lambda s: self._buffer.append(s)

    def flush(self):
        os.write(self._fd, self._buffer.build())
        self._buffer = __pypy__.builders.StringBuilder()


def print(*args, **kwargs):
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


sys.stdin, sys.stdout = FastI(sys.stdin), FastO(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")



if __name__ == "__main__":
    main()

Solution (Python):
import sys


s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N, A, B, C, D = i2nn()
    S = i2s()

    s1 = S[A:C-1]
    s2 = S[B:D-1]
    if s1.find('
        print('No')
        return

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

main()

Solution (Python):
import sys

readline = sys.stdin.readline

N, A, B, C, D = map(int, readline().split())
A, B, C, D = (x - 1 for x in [A, B, C, D])

S = readline().rstrip()
S2 = [S[i:i+2] for i in range(0, N - 1)]
S3 = [S[i:i+3] for i in range(0, N - 2)]

if C < D:
    ac = S2[A:C]
    bd = S2[B:D]
    if ac.count('
        print('No')
    elif bd.count('
        print('No')
    else:
        print('Yes')
else:
    bd = S2[B:D]
    ac = S2[A:C]
    if bd.count('
        print('No')
    elif ac.count('
        print('No')
    else:
        abd = S3[B - 1: D]
        if abd.count('...') > 0:
            print('Yes')
        else:
            print('No')

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

    if C < D:  
        for i in range(B, D):
            if S[i] == '
                return False

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

        for i in range(A, C):
            if S[i] == '
                return False

    return True


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

Solution (Python):
inpl = lambda: list(map(int,input().split()))
def get_sequence(arr):
    if len(arr) == 0:
        return [], []
    elements = []
    nums = []
    n = 1
    prev = arr[0]
    for c in arr[1:]:
        if c == prev:
            n += 1
        else:
            elements.append(prev)
            nums.append(n)
            prev = c
            n = 1
    elements.append(prev)
    nums.append(n)
    return elements, nums

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

ACarr = S[A-1:C]
BDarr = S[B-1:D]
ACseq = get_sequence(ACarr)[1]
ACrock = ACseq[1::2]
BDseq = get_sequence(BDarr)[1]
BDrock = BDseq[1::2]
if max(ACrock) > 1 or max(BDrock) > 1:
    print('No')
    exit()
elif C > D:
    if ((S[B-2]==S[B-1] and BDseq[0] >= 2)
        or (S[D]==S[D-1] and BDseq[-1] >= 2)
        or max(BDseq[::2]) >= 3):
        print('Yes')
    else:
        print('No')
else:
    print('Yes')

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

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

Solution (Python):
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()

def main():
    N, A, B, C, D = LI_()
    S = SI()
    ans = True
    
    for i in range(A, C):
        if S[i: i + 2] == '
            ans = False
            break
    
    if ans:
        for i in range(B, D):
            if S[i: i + 2] == '
                ans = False
                break
    
    if ans and D < C:
        tmp = False
        for i in range(B - 1, D):
            if S[i: i + 3] == '...':
                tmp = True
                break
        ans = ans and tmp

    ans = 'Yes' if ans else 'No'
    return ans

print(main())

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

res = 'Yes'

if C < D:
    for i in range(A-1, C-1):
        if S[i] == '
            res = 'No'
    for i in range(B-1, D-1):
        if S[i] == '
            res = 'No'
else:
    cnt = 0
    for i in range(B-2, D-1):
        if S[i] == '.' and S[i+1] == '.' and S[i+2] == '.':
            cnt += 1
    if cnt == 0:
        res = 'No'
    for i in range(A-1, C-1):
        if S[i] == '
            res = 'No'

print(res)

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007


def A():
    n,a,b,c,d = LI()
    s = input()
    a -= 1
    b -= 1
    c -= 1
    d -= 1
    if c == d:
        print("No")
    else:
        if c < d:
            k = s[b:d+1]
            for i in range(d-b):
                if k[i] == k[i+1] == "
                    print("No")
                    quit()
            k = s[a:c+1]
            for i in range(c-a):
                if k[i] == k[i+1] == "
                    print("No")
                    quit()
            print("Yes")
        else:
            k = s[b:d+1]
            for i in range(d-b):
                if k[i] == k[i+1] == "
                    print("No")
                    quit()
            k = s[a:c+1]
            for i in range(c-a):
                if k[i] == k[i+1] == "
                    print("No")
                    quit()
            k = s[b-1:d+2]
            for i in range(len(k)-2):
                if k[i] == k[i+1] == k[i+2] == ".":
                    print("Yes")
                    quit()
            print("No")
    return


def B():
    s = S()

    return


def C():
    n = I()

    return


def D():
    n = I()

    return


def E():
    n = I()

    return


def F():
    n = I()

    return


if __name__ == "__main__":
    A()

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

S = input()
x = [0]

for s in S:
    if s == '
        x.append(1)
    else:
        x.append(0)

flag = 0

for i in range(a, c):
    if x[i] + x[i+1] == 2:
        flag = 1
for i in range(b, d):
    if x[i] + x[i+1] == 2:
        flag = 1

flag2 = 1

if c > d:
    for i in range(b-1, d):
        if x[i] + x[i+1] + x[i+2] == 0:
            flag2 = 0
else:
    flag2 = 0

if flag + flag2 == 0:
    print('Yes')
else:
    print('No')

Solution (Python):
import os
import sys

if os.getenv('LOCAL'):
    sys.stdin = open('_in.txt', 'r')

sys.setrecursionlimit(2147483647)
INF = float('inf')

N, A, B, C, D = list(map(int, sys.stdin.readline().split()))
S = '.' + sys.stdin.readline().rstrip()


def can_go(s, e):
    i = s + 1
    while i <= e:
        if S[i - 1] == S[i] == '
            return False
        i += 1
    return True


def solve2():
    assert D < C
    if not can_go(A, C) or not can_go(B, D):
        return False
    i = B
    while i <= D:
        if S[i - 1] == S[i] == S[i + 1] == '.':
            return True
        i+=1
    return False


def solve():
    if C < D:
        return can_go(A, D)
    return solve2()


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

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

if C==D:
    print("No")
elif C<D:
    count = 0
    flg=True
    for i in range(B,D):
        if S[i]=="
            count+=1
        else:
            count=0
        if count>=2:
            flg=False
            break
    count=0
    for i in range(A,C):
        if S[i]=="
            count+=1
        else:
            count=0
        if count>=2:
            flg=False
            break

    if flg:
        print("Yes")
    else:
        print("No")
else:
    count = 0
    flg=True
    for i in range(B,D):
        if S[i]=="
            count+=1
        else:
            count=0
        if count>=2:
            flg=False
            break
    count=0
    count2 = 0
    flg2=False
    for i in range(A,C):
        if S[i]=="
            count+=1
        else:
            count=0
        if count>=2:
            flg=False
            break
        if i>=B-2 and i<=D:
            if S[i]==".":
                count2+=1
            else:
                count2=0
            if count2>=3:
                flg2=True
    if flg and flg2:
        print("Yes")
    else:
        print("No")

Solution (Python):
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from math import ceil, floor
from sys import setrecursionlimit

import heapq as hq
import itertools as its
import operator as op



inf = float('inf')
N = 0


def set_inputs():
    global N
    return


def main():
    setrecursionlimit(100000)
    set_inputs()
    
    n, a, b, c, d = get_li()
    s = get_str()
    if "
        print("No")
        return
    if "
        print("No")
        return
    if c > d and ("..." not in s[b:d]) and s[b-2:b+1] != "..." and s[b-1:b+2] != "..." and s[d-2:d+1] != "...":
        print("No")
        return
    print("Yes")
    return


def get_int():
    return int(input())


def get_float():
    return float(input())


def get_str():
    return input().strip()


def get_li():
    return [int(i) for i in input().split()]


def get_lf():
    return [float(f) for f in input().split()]


def get_lc():
    return list(input().strip())


def get_data(n, types, sep=None):
    if len(types) == 1:
        return [types[0](input().strip()) for _ in range(n)]
    return list(zip(*(
        [t(x) for t, x in zip(types, input().strip().split(sep=sep))]
        for _ in range(n)
    )))


if __name__ == '__main__':
    main()

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

if '
    print('No')
    exit()
if '
    print('No')
    exit()

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

Solution (Python):

n, a, b, c, d =[int(i) for i in input().split()]
s = input()

if c < d:
    s1 = s[a-1:d]
    if s1.count("
        print("Yes")

    else:
        print("No")

else:
    s1 = s[a-1:c]
    s2 = s[b-2:d+1]
    if s1.count("
        print("Yes")

    else:
        print("No")

Solution (Python):
import sys, math, collections, heapq, itertools
def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while a % b > 0: a, b = b, a % b
    return b
  
def solve():
    N, A, B, C, D = map(int, input().split())
    S = input()
    Able = False
    if C < D:
        for i in range(A-1, C-1):
            if S[i] == S[i+1] == "
                break
        else:
            for i in range(B-1, D-1):
                if S[i] == S[i+1] == "
                    break
            else: Able = True
    else:
        for i in range(A-1, C-1):
            if S[i] == S[i+1] == "
                break
        else:
            for i in range(B-1, D):
                if S[i-1] == S[i] == S[i+1] ==".":
                    Able = True
                    break
    print("Yes" if Able else "No")



    INF = 10 ** 25
    mod = 7 + 10 ** 9
    return 0
  
if __name__ == "__main__":
    solve()

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

OK = True
if A < C < B < D or A < B < C < D:
    if S[A:C+1].count("
        pass
    else:
        OK = False
else:
    if S[A:C+1].count("
        pass
    else:
        OK = False
if OK:
    print("Yes")
else:
    print("No")

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

s = input()
flag = True
flag2 = False
if d>c:
    tmpflag = False
    for i in range(b-1,d):
        if tmpflag:
            if s[i] == '
                flag = False
                break
            else:
                tmpflag = False
        elif s[i] == '
            tmpflag = True
    
    for i in range(a-1,c):
        if tmpflag:
            if s[i] == '
                flag = False
                break
            else:
                tmpflag = False
        elif s[i] == '
            tmpflag = True
    if flag:
        print('Yes')
    else:
        print('No')
else:
    tmpflag = False
    for i in range(a-1,c):
        if tmpflag:
            if s[i] == '
                flag = False
                break
            else:
                tmpflag = False
        elif s[i] == '
            tmpflag = True
    counter = 0
    for i in range(b-2,d+1):
        if s[i] == '.':
            counter += 1
            if counter == 3:
                flag2 = True
        if s[i] == '
            counter = 0
    if flag and flag2:
        print('Yes')
    else:
        print('No')

Solution (Python):
def f(x, y):
	if '
		return 0
	else:
		return 1

def g(x, y):
	if '...' in S[x - 2:y + 1]:
		return 1
	else:
		return 0

N, A, B, C, D = map(int, input().split())
S = input()
if C < D:
	x = f(A, C) * f(B, D)
	if x == 1:
		print('Yes')
	else:
		print('No')
else:
	x = f(A, C) * f(B, D) * g(B, D)
	if x == 1:
		print('Yes')
	else:
		print('No')

Solution (Python):
N,A,B,C,D = map(int,input().split())
S = input()
if (A-B)*(C-D) < 0 and "..." not in S[max(A,B)-2:min(C,D)+1]:
  print("No")
elif "
  print("Yes")
else:
  print("No")

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

for i in range(min(a, b), max(c, d)):
  if S[i-1] == "
    print("No")
    exit()
if a < b and c > d or a > b and c < d:

  for i in range(max(a, b)-1, min(c, d)):
    if S[i-1] == "." and S[i] == "." and S[i+1] == ".":
      print("Yes")
      exit()
  print("No")
  exit()
print("Yes")

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


goal = max([c,d])
for x in range(a+1, goal):
  if s[x] == '
    print('No')
    exit(0)

if c < d:
  print('Yes')
  exit(0)

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

print('No')

Solution (Python):


from sys import stdout
from bisect import bisect_left as binl
from copy import copy, deepcopy
from collections import defaultdict
import math


mod = 1


def intin():
    input_tuple = input().split()
    if len(input_tuple) <= 1:
        return int(input_tuple[0])
    return tuple(map(int, input_tuple))


def intina():
    return [int(i) for i in input().split()]


def intinl(count):
    return [intin() for _ in range(count)]


def modadd(x, y):
    global mod
    return (x + y) % mod


def modmlt(x, y):
    global mod
    return (x * y) % mod


def mod_inv(x):
    
    global mod
    return pow(x, mod - 2, mod)


def gcm(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x


def combination(x, y):
    assert(x >= y)

    ret = math.factorial(x)
    ret = ret // (math.factorial(x - y) * math.factorial(y))

    return ret


def get_divisors(x):
    retlist = []
    for i in range(1, int(x**0.5) + 3):
        if x % i == 0:
            retlist.append(i)
            retlist.append(x // i)
    return retlist


def get_factors(x):
    retlist = []
    for i in range(2, int(x**0.5) + 3):
        while x % i == 0:
            retlist.append(i)
            x = x // i
    retlist.append(x)
    return retlist


def make_linklist(xylist):
    linklist = {}
    for a, b in xylist:
        linklist.setdefault(a, [])
        linklist.setdefault(b, [])
        linklist[a].append(b)
        linklist[b].append(a)
    return linklist


def calc_longest_distance(linklist, v=1):
    distance_list = {}
    distance_count = 0
    distance = 0
    vlist_previous = []
    vlist = [v]
    nodecount = len(linklist)

    while distance_count < nodecount:
        vlist_next = []
        for v in vlist:
            distance_list[v] = distance
            distance_count += 1
            vlist_next.extend(linklist[v])
        distance += 1
        vlist_to_del = vlist_previous
        vlist_previous = vlist
        vlist = list(set(vlist_next) - set(vlist_to_del))

    max_distance = -1
    max_v = None
    for v, distance in distance_list.items():
        if distance > max_distance:
            max_distance = distance
            max_v = v

    return (max_distance, max_v)


def calc_tree_diameter(linklist, v=1):
    _, u = calc_longest_distance(linklist, v)
    distance, _ = calc_longest_distance(linklist, u)
    return distance


class UnionFind:

    def __init__(self, n):
        self.parent = [i for i in range(n)]

    def root(self, i):
        if self.parent[i] == i:
            return i
        self.parent[i] = self.root(self.parent[i])
        return self.parent[i]

    def unite(self, i, j):
        rooti = self.root(i)
        rootj = self.root(j)
        if rooti == rootj:
            return
        if rooti < rootj:
            self.parent[rootj] = rooti
        else:
            self.parent[rooti] = rootj

    def same(self, i, j):
        return self.root(i) == self.root(j)





def f(s, start, goal):
    count = 0
    for i in range(start, goal):
        if s[i] == '
            count += 1
            if count >= 2:
                return False
        if s[i] == '.':
            count = 0
    return True


def main():
    n, a_start, b_start, a_goal, b_goal = intin()
    s = input()
    a_start -= 1
    b_start -= 1
    a_goal -= 1
    b_goal -= 1

    if b_goal < a_goal and \
       (s[b_start-1] == '
       (s[b_goal-1] == '
        count = 0
        for i in range(b_start, b_goal + 1):
            if s[i] == '.':
                count += 1
                if count >= 3:
                    break
            if s[i] == '
                count = 0
        else:
            print('No')
            return

    if not f(s, a_start, a_goal):
        print('No')
        return

    if not f(s, b_start, b_goal):
        print('No')
        return

    print('Yes')


if __name__ == '__main__':
    main()

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

Solution (Python):
N,A,B,C,D = map(int,input().split())
S = input()
if C<D:
    print('No' if ('
    exit()

if '
    print('No')
    exit()
for bi in range(B-1,D):
    if S[bi-1] == S[bi] == S[bi+1] == '.':
        print('Yes')
        exit()
print('No')

Solution (Python):
n,a,b,c,d=map(int,input().split())
s=["
if c<d:
    for now,goal in [(b,d),(a,c)]:
        while now < goal:
            if s[now+1]==".":
                now+=1
            elif now < n-1 and s[now+2]==".":
                now+=2
            else:
                print("No")
                exit()
    print("Yes")
else:
    for now,goal in [(b,d),(a,c)]:
        while now < goal:
            if now < n-1 and s[now+2]==".":
                now+=2
            elif s[now+1]==".":
                now+=1
            else:
                print("No")
                exit()
    for i in range(b-1,d):
        if s[i]=="." and s[i+1]=="." and s[i+2]==".":
            print("Yes")
            break
    else:
        print("No")

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

S = " " + input()






def solve(N, A, B, C, D, S):
    if S[A:C].find("
        return "No"
    if S[B:D].find("
        return "No"

    
    if A < C < B < D:
        return "Yes"

    
    if A < B < C < D:
        return "Yes"

    
    if A < B < D < C:
        if S[B-1:D+2].find("...") != -1:
            return "Yes"
    return "No"

print(solve(N, A, B, C, D, S))

Solution (Python):
n,a,b,c,d=map(int, input().split(' '))
a -= 1
b -= 1
c -= 1
d -= 1
s = input()
if c == d:
    ans = 'No'
elif c < d:
    n0 = s[a:d].count('
    if n0 != 0:
        ans = 'No'
    else:
        ans = 'Yes'
else:
    n0 = s[a:c].count('
    n1 = s[b-1:d+2].count('...')
    if n0 == 0 and n1 != 0:
        ans = 'Yes'
    else:
        ans = 'No'
print(ans)

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

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

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