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 heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from fractions import gcd
from math import factorial, sqrt, ceil
from functools import lru_cache, reduce
INF = 1 << 60
MOD = 1000000007
sys.setrecursionlimit(10 ** 7)


class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True




def warshall_floyd(d, n):
    
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d



def dijkstra_heap(s, edge, n):
    
    d = [10**20] * n
    used = [True] * n 
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr


def lcm(x, y):
    return (x * y) // gcd(x, y)


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


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






def eratosthenes(limit):
    A = [i for i in range(2, limit+1)]
    P = []

    while True:
        prime = min(A)
        
        if prime > sqrt(limit):
            break
            
        P.append(prime)
            
        i = 0
        while i < len(A):
            if A[i] % prime == 0:
                A.pop(i)
                continue
            i += 1
            
    for a in A:
        P.append(a)
            
    return P


def permutation_with_duplicates(L):

    if L == []:
        return [[]]

    else:
        ret = []

        
        S = sorted(set(L))

        for i in S:

            data = L[:]
            data.remove(i)

            for j in permutation_with_duplicates(data):
                ret.append([i] + j)

        return ret



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


def func1(start, goal):
    for i in range(start, goal):
        if s[i] == "
            return False
    return True

def func2(start, goal, n):
    for i in range(start, goal + 1):
        if i == 0 or i == n - 1:
            continue
        if s[i - 1] == "." and s[i] == "." and s[i + 1] == ".":
            return True
    return False

if not (func1(a, c) and func1(b, d)):
    print("No")
    sys.exit()

if c < d:
    print("Yes")
else:
    if func2(b, d, n):
        print("Yes")
    else:
        print("No")

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

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

Solution (Python):
n, a, b, c, d = map(int, input().split())
s = str(input())
if '
    print('No')
else:
    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())
s = input()

def check_twice(left, right, l):
    for i in range(left-1, right):
        if l[i] == '
            return False
    return True

def check_triple(left, right, l):
    f = False
    for i in range(left-1, right-2):
        if l[i] == '.' and l[i+1] == '.' and l[i+2] == '.':
            f = True
            break
        else:
            continue
    return f

if c < d:
    flg = check_twice(a, c, s) & check_twice(b, d, s)
    if flg is True:
        print('Yes')
    else:
        print('No')

else:
    flg = check_twice(a, c, s) & check_triple(b-1, d+1, s)
    if flg is True:
        print('Yes')
    else:
        print('No')

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

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

Solution (Python):


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

start = a-1
end = c-1
sharp_count = 0
for i in range(start+1, (end-1)+1):
    if s[i] == "
        print("No")
        exit()

start = b-1
end = d-1
sharp_count = 0
for i in range(start+1, (end-1)+1):
    if s[i] == "
        print("No")
        exit()

if d < c:
    start = b-1
    end = d-1

    flag = 0
    for i in range(start, end+1):
        if s[i-1] == "." and (s[i-1] == s[i]) and (s[i] == s[i+1]):
            flag = 1
    if flag == 0:
        print("No")
        exit()






















































print("Yes")

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

l = len(S)
C = True
D = False
for i in range(l-1):
  if i >= min(a,b) and S[i]=='
    C = False
    break
  if c > d and d > i >= max(a,b)-1:
    if S[i-1]=='.' and S[i]=='.' and S[i+1]=='.':
      D = True
      
if not C:
  print('No')
elif C and not D:
  if c < d:
    print('Yes')
  else:
    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()

if c<d or c<b:
    
    if s[b:d+1].count("
        print("Yes")
    else:
        print("No") 
else:
    if s[b-1:d+2].count("...")==0:
        print("No")
    else:
        if s[b:d+1].count("
            print("Yes")
        else:
            print("No")

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

bef = ''
row_dot_max = 0
count = 0
for i, s in enumerate(S):
  if bef == '
    print('No')
    exit()
  
  if s == '.' and i >= B-2 and i <= D:
    count += 1
  else:
    row_dot_max = max(row_dot_max, count)
    count = 0
  bef = s

row_dot_max = max(row_dot_max, count)
if C > D:
  if row_dot_max >= 3:
    print('Yes')
  else:
    print('No')
else:
  print('Yes')

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

ans = 'Yes'
if '
  ans = 'No'  
if '
  ans = 'No'
  
if c > d:
  if '...' not in s[b-2:d+1]:
    ans = 'No'

print(ans)

Solution (Python):

n, a, b, c, d = map(int, input().split())
s = input()
p = "
if c > d:
    p *= "..." in s[b-2:d+1]
print(p and "Yes" or "No")

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7


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


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

    
    for i in range(A + 1, max(C, D)):
        if S[i] == S[i + 1] == "
            print("No")
            return

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

        print("No")
        return


if __name__ == "__main__":
    main()

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

def check_three(x,y):
    for i in range(x-1,y):
        if (not s[i]) and (not s[i+1]) and (not s[i+2]):
            return True
    return False

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

Solution (Python):
N,A,B,C,D=map(int,input().split())
s=list('.'+input())
def ren(start,end):
    count=0
    MAX=0
    for k in range(start,end+1):
        if s[k]==".":
            count+=1
            MAX=max(count,MAX)
        else:
            count=0
    return MAX>=3


def S(snuke,c):
    while snuke<=c and s[snuke]==".":
        if snuke==c:
            return True
        if s[snuke+1]=='
            snuke+=2
        else:
            snuke+=1
    return False

def H(hnuke,d):
    while hnuke<=d and s[hnuke]==".":
        if hnuke==d:
            return True
        if s[hnuke+1]=='
            hnuke+=2
        else:
            hnuke+=1
    return False


x=S(A,C)
y=H(B,D)

if (B<A and C<D):
    z= x and y and ren(A-1,C+1)

elif (A<B and D<C):
    z= x and y and ren(B-1,D+1)
else:
    z= x and y
print("Yes" if z else "No")

Solution (Python):
def main():
    N, A, B, C, D = list(map(int, input().split(' ')))
    S = input()
    if C == D:
        print('No')
    elif C < D:
        for s in [S[(A-1):C], S[(B-1):D]]:
            for i in range(len(s) - 1):
                if s[i:(i+2)] == '
                    print('No')
                    return
        print('Yes')
    else:
        
        s = S[(A-1):C]
        for i in range(len(s) - 1):
            if s[i:(i + 2)] == '
                print('No')
                return
        s = S[(B-2):(D+1)]
        ok = False
        for i in range(1, len(s) - 1):
            if s[(i-1):(i+2)] == '...':
                ok = True
                break
        print('Yes' if ok else 'No')


if __name__ == '__main__':
    main()

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






left = A

if C < D:
    right = D
else:
    right = C
    idx = []
    for i in range(B - 2, D - 1):
        if S[i] == '.' and S[i + 1] == '.' and S[i + 2] == '.':
            idx.append(i)
    if not idx:
        print('No')
        exit()
    
    

T = S[left - 1:right + 1]

for i in range(len(T) - 1):
    if T[i] == '
        print('No')
        exit()

print('Yes')

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




if re.search(r'
    print('No')
else:
    if c>d:
        if (re.search(r'\.{3,}',s[b-1:d+2])):
            print('Yes')
        else:
            print('No')
    else:
        print('Yes')

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

if re.search(r'
    print('No')
else:
    if c>d:
        if (re.search(r'\.{3,}',s[b-1:d+2])):
            print('Yes')
        else:
            print('No')
    else:
        print('Yes')

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


if re.search(r'
    print('No')
else:
    if c>d:
        if (re.search(r'\.{3,}',s[b-2:d+1])):
            print('Yes')
        else:
            print('No')
    else:
        print('Yes')

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

"""
基本的にはシャープが2連続するとだめ
ただし，片方が間に必ず入っている場合は，...が三連続するところがないとダメ
"""

if A<B and C>D:
    for i in range(B-2,D-1):
        if S[i:i+3] == [".", ".", "."]:
            print("Yes")
            exit()
    print("No")
    exit()
elif A>B and C<D:
    for i in range(A-2,C-1):
        if S[i:i+3] == [".", ".", "."]:
            print("Yes")
            exit()
    print("No")
    exit()
else:
    for i in range(min(A,B)-1, max(C,D)-1):
        if S[i] == S[i+1] == "
            print("No")
            exit()
print("Yes")

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

Solution (Python):


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

should_change = int(C>D)
can_change = 0
space = 1
ans = 'Yes'

for i in range(A,max(C,D)):
    if S[i]=='.':
        space += 1
        if B<=i<=D and space==3:
            can_change = 1
    else:
        if space==0:
            ans = 'No'
            break
        space = 0

if can_change<should_change:
    ans = 'No'
print(ans)

Solution (Python):
N, A, B, C, D = map(int, input().split())
S = input()
if "
	print("No")
	exit()
for i in range(B - 1, D):
	if S[i] == "." and S[i - 1] == ".":
		if D == N or C < D:
			print("Yes")
			exit()
		else:
			if S[i + 1] == ".":
				print("Yes")
				exit()
print("No")

Solution (Python):
import sys
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]=="
      print("No")
      sys.exit()
  print("Yes")
  sys.exit()
else:
  for i in range(A-1,C-1):
    if S[i]=="
      print("No")
      sys.exit()  
  for i in range(B-2,D-1):
    if S[i]=="." and S[i+1]=="." and S[i+2]==".":
      print("Yes")
      sys.exit()
    if i==D-2:
      print("No")
      sys.exit()
  print("Yes")
  sys.exit()

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

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

Solution (Python):
_, A, B, C, D = map(lambda n: int(n) - 1, input().split())
S = input()
if S.count("
    print("No")
elif C < D:
    print("Yes")
elif S.count("...", B - 1, D + 2):
    print("Yes")
else:
    print("No")

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

s = A
f = B
flag = True
if C < D:
    if '
        flag = False
    if '
        flag = False

else:
    if S[D - 2] == '
        if '...' not in S[B-2:D]:
            flag = False
    if '
        flag = False
ans = 'Yes' if flag else 'No'
print(ans)

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

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

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

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]:
    print('Yes')
  else:
    print('No')

Solution (Python):
import sys
from collections import Counter
from collections import deque
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n,a,b,c,d=mp()
s=input()
if s[a-1]=="
    print("No")
    exit()
for i in range(min(a,b)-1,max(c,d)):
    if s[i]=="
        print("No")
        exit()
if d<c:
    ch=False
    for i in range(b-2,d-1):
        if s[i]=="." and s[i+1]=="." and s[i+2]==".":
            ch=True
    if ch:
        print("Yes")
        exit()
    else:
        print("No")
        exit()
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:
    print('Yes' if '...' in S[B-2:D+1] else 'No')

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

Solution (Python):
import sys











stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18



n,a,b,c,d = map(int, stdin.readline().rstrip().split())




s = str(stdin.readline().rstrip())

if "
    print("No")
else:
    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())
s = input()
ans = 'Yes'
if '
    ans = 'No'
else:
    if c > d and '...' not in s[b-2:d+1]:
        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()
s+='X'
ch=1
v=[]
st=[]
if s[0]=='
    v.append((0,0))
for i in range(1,n+1):
    if s[i]==s[i-1]:
        ch+=1
    else:
        v.append((ch,i-ch))
        ch=1
judge=[]
for i in range(len(v)):
    if i%2==1:
        x,y=v[i]
        if x>=2 and ((a < y and y < c) or (b < y and y < d)):
            print('No')
            exit()
    else:
        x,y=v[i]
        if x>=3:
            judge.append((y,y+x-1))
check=1
if (a<b and d<c) or (b<a and c<d):
    check = 0
    while judge:
        t1,t2=judge.pop()
        if t2>a and t2>b and t1<c and t1<d:
            check = 1
if check == 1:
    print('Yes')
else:
    print('No')

Solution (Python):
N, A, B, C, D = map(int, input().split())
S = input()
if C < D:
    if '
        print('Yes')
    else:
        print('No')
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 c<d:
  if "
    print("Yes")
  else:
    print("No")
else:
  if "..." in s[b-2:d]:
    print("Yes")
  else:
    if s[d-2]=="
      print("No")
    else:
      print("Yes")

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

Solution (Python):

import collections
import itertools as it
import math

 

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





is_rock2 = '
is_empty3 = '...' in s[b-1:d+2]

joken = (not is_rock2) and (is_empty3 if c > d else 1)
print('Yes' if joken else 'No')

Solution (Python):


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



h = S[A-1:D+1].count('
m3 = S[B-2:D+1].count('...')

if C < D:
    if h == 0: print('Yes')
    else: print('No')
else:
    if m3 != 0 and h == 0:
        print('Yes')
    else: print('No')

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

Solution (Python):

from re import search
def myAnswer(N:int,A:int,B:int,C:int,D:int,S:str) -> str:
   if (search(r'
   if(C > D):
      return "Yes" if (search(r'\.\.\.',S[B - 2:D+1])) else "No"
   return "Yes"

def modelAnswer():
   return
def main():
   N,A,B,C,D = map(int,input().split())
   S = input()
   print(myAnswer(N,A,B,C,D,S))
if __name__ == '__main__':
   main()

Solution (Python):
import sys
import re
import math
import collections
import decimal
import bisect
import itertools

import copy






INF = sys.maxsize
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))





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

    stone_twice_flg = True
    for i in range(a, max(c, d)):
        if s[i] == s[i + 1] == "
            stone_twice_flg = False
            break

    pass_flg = False
    if c > d:
        for i in range(b, d+1):
            if s[i - 1] == s[i] == s[i + 1] == ".":
                pass_flg = True
                break
    else:
        pass_flg = True

    if stone_twice_flg and pass_flg:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Solution (Python):
import re
N,A,B,C,D = (int(x) for x in input().split())
S = input()
if re.search(r'
    print('No')
else:
    if D < C:
        if re.search(r'\.\.\.',S[B-2:D+1]):
            print('Yes')
        else:
            print('No')
    else:
        print('Yes')

Solution (Python):
import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7



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

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


if __name__ == '__main__':
    main()

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


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

    can_jump_R = True  
    can_jump_B = False  
    for i in range(A + 1, N - 1):
        if S[i] == S[i+1] == "
            if A < i < C or B < i < D:
                can_jump_R = False
        if S[i-1] == S[i] == S[i+1] == ".":
            if B <= i < C and i-1 != D:
                can_jump_B = True

    if C < D:
        if can_jump_R:
            ans = "Yes"
        else:
            ans = "No"
    else:
        if can_jump_R and can_jump_B:
            ans = "Yes"
        else:
            ans = "No"
    print(ans)


if __name__ == "__main__":
    main()

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

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

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

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

print(ans)

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

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


        print('No')



if __name__ == '__main__':
    main()

Solution (Python):
import sys
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')
        sys.exit()
for i in range(b+1, d-1):
    if s[i-1]==s[i]=='
        print('No')
        sys.exit()
if c<d:
    print('Yes')
else:
    for i in range(b-1, d):
        if s[i-1]==s[i]==s[i+1]=='.':
            print('Yes')
            sys.exit()
    print('No')

Solution (Python):
import sys

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

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

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

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

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

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

if S[A-1:C].find('
    print('No')
    exit()

ans = 'Yes'
if C > D and S[B-2:D+1].find('...') == -1:
    ans = 'No'
print(ans)

Solution (Python):
def main():
    
    N, A, B, C, D = (int(_) for _ in input().split())
    A, B, C, D = A-1, B-1, C-1, D-1
    S = input()

    sa, sb = S[A:C+1], S[B:D+1]
    can1 = can2 = True
    for i in range(len(sa)-1):
        if sa[i] == '
    for i in range(len(sb)-1):
        if sb[i] == '
    can = can1 and can2

    if can and D < C:
        sc = S[B-1:D+2]
        can3 = False
        for i in range(len(sc)-2):
            if sc[i] == '.' and sc[i+1] == '.' and sc[i+2] == '.': can3 = True
        can = can and can3

    print('Yes' if can else 'No')
    return

if __name__ == '__main__':
    main()

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

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

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

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 d<c:
    if "
        print('Yes')
    else:
        print('No')
    
else:
    if "
        print('Yes')
    else:
        print('No')

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

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

def solve(E, x, y, G):
    if y != -1:
        E[y-1] = '
    dp = [0]*N
    dp[x-1] = 1
    for i in range(2, N):
        if dp[i-2] or dp[i-1]:
            if E[i] == '.':
                dp[i] = 1
    
    return dp[G-1]

if C < D:
    p = solve(S, B, -1, D)
    q = solve(S, A, -1, C)
else:
    bla = 0
    idx = -1
    for i in range(B-2, N):
        if S[i] == '.':
            bla += 1
        else:
            bla = 0
        if bla == 3:
            idx = i
            break
    
    if idx == -1:
        print('No')
        exit()
    else:
        if D - 1 <= idx - 2:
            print('No')
            exit()

    p = solve(S, A, -1, C)
    q = solve(S, B, -1, D)
    

if p and q:
    print('Yes')
else:
    print('No')

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

if c<d:
    if s[min(a,b)-1:d+1].count("
        print("Yes")
    else:
        print("No")
else:
    if s[min(a,b)-1:d+1].count("
        if s[max(a,b)-2:d+1].count("...")==0:
            print("No")
        else:
            print("Yes")
    else:
        print("No")

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


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

    flg = False
    for i in range(a, d):
        if s[i] == "
            if s[i + 1] == "
                print("No")
                break

        if b - 1 <= i:
            if i + 1 < n:
                if s[i - 1] == s[i] == s[i + 1] == ".":
                    flg = True
    else:
        if c < d:
            print("Yes")
        else:
            if flg:
                print("Yes")
            else:
                print("No")


if __name__ == '__main__':
    resolve()

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 d < c and not "..." in s[b-1:d+2]:
    print("No")
    exit()

print("Yes")