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

A#.B#..

.#AB#..

.#A.#B.

.#.A#B.

.#.A#.B

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

Solution (Python):
n,a,b,c,d = map(int,input().split())
s = '.'+input()
i=a
f = True
while i<c:
    if s[i+1]=='.':
        i += 1
    elif i<c-1 and s[i+2]=='.':
        i += 2
    else:
        f = False
        break
i = b
ok = False
while i<d:
    if s[i-1:i+2]=='...':
        ok = True
    if s[i+1]=='.':
        i += 1
    elif i<d-1 and s[i+2]=='.':
        i += 2
    else:
        f = False
        break
if d<n and s[d-1:d+2]=='...':ok=True
if d<c and not ok:f=False
print('Yes' if f else 'No')

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

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

Solution (Python):
def no():
    print("No")
    exit()

n, a, b, c, d = map(int, input().split())
s = list(input())
for i in range(a - 1, c - 1):
    if s[i] == s[i + 1] == "
        no()
for i in range(b - 1, d - 1):
    if s[i] == s[i + 1] == "
        no()
if c > d:
    t = 0
    for i in range(b - 2, d - 1):
        if s[i] == s[i + 1] == s[i + 2] == ".":
            t = 1
    if t == 0:
        no()
print("Yes")

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

if C > D:
  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()
a -= 1
b -= 1
c -= 1
d -= 1


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

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

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

Solution (Python):
n,a,b,c,d=map(int,input().split())
s=input()
flag=0
for i in range(n):
  if a-1<=i<=c-1 or b-1<=i<=d-1:
    if flag==1 and s[i]=="
      print("No")
      exit()
    elif flag==0 and s[i]=="
      flag=1
    elif s[i]==".":
      flag=0

m=0
con=0
if d<c:
  for i in range(b-2,d+1):
    if s[i]==".":
      con+=1
      m=max(m,con)
    else:
      con=0
  if m>=3:
    print("Yes")
    exit()
  else:
    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()
for i in range(A-1,max(C,D)-1):
    if S[i] == '
        print('No')
        exit()
if D < C:
    for i in range(B-2,N-2):
        if S[i] == '.' and S[i+1] == '.' and S[i+2] == '.':
            print('Yes')
            exit()
        if i+1 == D-1:
            break
    print('No')
    exit()
else:
    print('Yes')
    exit()

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n,a,b,c,d=map(int,input().split())
    s=input()
    for i in range(a,max(c,d)):
        if i+2<=n:
            if s[i:i+2]=='
                print("No")
                break
    else:
        if c<d:
            print("Yes")
        else:
            flag=False
            for i in range(b-1,d):    
                if s[i-1:i+2]=="...":
                    flag=True
            if flag==True:
                print("Yes")
            else:
                print("No")

if __name__=='__main__':
    main()

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n,a,b,c,d=map(int,input().split())
    s=input()
    for i in range(a,max(c,d)):
        if i+2<=n:
            if s[i:i+2]=='
                print("No")
                break
    else:
        if c<d:
            print("Yes")
        else:
            flag=False
            for i in range(b-1,d):    
                if s[i-1:i+2]=="...":
                    flag=True
            if flag==True:
                print("Yes")
            else:
                print("No")

if __name__=='__main__':
    main()

Solution (Python):
def check(s):
    for i in range(len(s) - 1):
        if s[i] == '
            return False
    return True


def checksp(s):
    for i in range(len(s) - 2):
        if s[i] == '.' and s[i + 1] == '.' and s[i + 2] == '.':
            return True
    return False


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

if C < D:
    if check(S[A:C+1]) and check(S[B:D+1]):
        print('Yes')
    else:
        print('No')
else:
    if checksp(S[B-1:D+2]) and check(S[B:D+1]) and check(S[A:C+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 '
        print('Yes')
    else:
        print('No')

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    N, A, B, C, D = map(int, rl().split())
    S = input()
    
    if C < D:
        if S[A - 1:D].find('
            print('Yes')
        else:
            print('No')
    else:
        if S[B - 2:D + 1].find('...') == -1:
            print('No')
        else:
            print('Yes')


if __name__ == '__main__':
    solve()

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

s=input()

s=list(s)

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

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

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






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


if not can_reach(A, C) or not can_reach(B, D):
    print("No")
    exit()

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


print("Yes")

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

if "
  print("No")
  exit()

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

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

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

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

Solution (Python):
N,A,B,C,D=map(int,input().split())
S=input()
if "
    print("No")
else:
    print("Yes")

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

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

cnt = 0
for i in range(a,max(c,d)+1):
    if s[i] == '
        cnt += 1
        if cnt >= 2:
            print('No')
            exit()
    else:
        cnt = 0

cnt = 0
if b >= 2:
    if s[b-2] == '.' and s[b-1] == '.':
        cnt = 2

if s[b-1] == '.':
    cnt = 1

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

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


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

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

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

flg = 0
cnt = 0
S_ac = S[A:C]
S_bd = S[B:D]

if '
    flg = 1

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

if flg == 1:
    print('No')
else:
    print('Yes')

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

flg = 0
cnt = 0
S_ac = S[A:C]
S_bd = S[B:D]

if '
    flg = 1

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

if flg == 1:
    print('No')
else:
    print('Yes')

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

if "
    print("No")
    exit(0)

if C <= D:
    print("Yes")
    exit(0)

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

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

Solution (Python):
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

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




















ans="Yes"

if D<C:
  if "..." not in S[B-2:D+1]:
    ans="No"

if "
  ans="No"

print(ans)

Solution (Python):
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

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









ans = "Yes"
if C > D:
    tmp = S[B-2:D+1].count("...")
    if tmp == 0:
        ans = "No"

tmp = S[A-1:max(C, D)].count("
if tmp > 0:
    ans = "No"
print(ans)

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

Solution (Python):
import sys
n, a, b, c, d = map(int, input().split())
s = input()
if any(s[i]==s[i+1]=="
    print("No")
elif 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):
N, A, B, C, D = map(int, input().split())
S = input()


def dfs(start, end):
    q = [start-1]
    while q:
        s = q.pop()
        if s==end-1:
            return True
        if s+2<N and S[s+2]==".":
            q.append(s+2)
        if s+1<N and S[s+1]==".":
            q.append(s+1)
    return False


res = dfs(A, C) and dfs(B, D)

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

Solution (Python):
import sys
input = sys.stdin.readline
def main():
    _, A, B, C, D = map(int, input().split())
    S = input().rstrip("\r\n")
    ans = "Yes"
    for i in range(A-1,C-1):
        if S[i] == "
            ans = "No"
            break
    for i in range(B-1,D-1):
        if S[i] == "
            ans = "No"
            break
    if C < D or ans == "No":
        print(ans)
    else:
        ans = "No"
        for i in range(B-1, D):
            if S[i-1] == "." and S[i] == "." and S[i+1] == ".":
                ans = "Yes"
        print(ans)
if __name__ == "__main__":
    main()

Solution (Python):
from collections import deque

def dfs(snuke,fnuke):
    global n,a,b,c,d,s
    que = deque()
    que.append([snuke,fnuke])
    lq = 1
    while(lq > 0):
        tmp = que.pop()
        tmps = tmp[0]
        tmpf = tmp[1]
        lq-=1
        if tmps == c and tmpf == d:
            return True
        if tmps+1 != tmpf and s[tmps] =="." and tmps != c:
            que.append([tmps+1,tmpf])
            lq+=1
        elif tmps+2 != tmpf and s[tmps+1] =="." and tmps != c:
            que.append([tmps+2,tmpf])
            lq+=1
        elif tmpf+1 != tmps and s[tmpf] =="." and tmpf != d:
            que.append([tmps,tmpf+1])
            lq+=1
        elif tmpf+2 != tmps and s[tmpf+1] =="." and tmpf != d:
            que.append([tmps,tmpf+2])
            lq+=1
    return False

n,a,b,c,d = map(int,input().split())
s = input()
s += "
snuke = a
fnuke = b
if dfs(snuke,fnuke):
    print("Yes")
else:
    print("No")

Solution (Python):


N,A,B,C,D = map(int,input().split())
s = list(input())
ok = False



for i in range(A-1,C):

    if s[i-1:i+1] == ["
        print ("No")
        exit ()


for i in range(B-1,D):

    if s[i-1:i+1] == ["
        print ("No")
        exit ()




if C < D:
    ok = True
else:

    for i in range(B-1,D):

        if s[i-1:i+2] == [".",".","."]:
            ok = True
            break

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

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

ans = "Yes"
if c > d:
    tmp = s[b-2:d+1].count("...")
    if tmp == 0:
        ans = "No"

tmp = s[a-1:max(c,d)].count("
if tmp > 0:
    ans = "No"
print(ans)

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

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

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

if C > D:
    for j in range(B-1,D):
        if S[j-1] == '.' and S[j] == '.' and S[j+1] == '.':
            print('Yes')
            exit()

    print('No')
    exit()

else:
    print('Yes')
    exit()

Solution (Python):
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

"""
A<Bとする。
C<Dの場合：
A～CとB~Dの間に"
C>Dの場合：
上記に加え、B~Cの間に"..."が存在すれば達成できる
"""

n,a,b,c,d = map(int,readline().split())
s = readline().rstrip().decode('utf-8')
a,b,c,d = a-1,b-1,c-1,d-1

flag = 1
space = 0
res = 0
rock = 0
for i in range(a,c+1):
	if s[i] == "
		rock += 1
	else:
		rock = 0
	if rock >= 2:
		flag = 0
for i in range(b,d+1):
	if s[i] == "
		rock += 1
	else:
		rock = 0
	if rock >= 2:
		flag = 0
if c > d:
	for i in range(b-1,d+2):
		if s[i] == ".":
			space += 1
		else:
			res = max(res,space)
			space = 0
	res = max(res,space)
	if res < 3:
		flag = 0

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

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

str_ac = str[A-1:C]
str_bd = str[B-1:D]
str_bd2 = str[B-2:D+1]




if C<D:
  if str_bd.find("
    print("No")
  else:
    print("Yes")
else:
  if str_bd.find("
    print("No")
  else:
    if str_bd2.find("...")!=-1:
      print("Yes")
    else:
      print("No")

Solution (Python):
n,a,b,c,d = list(map(int, input().split()))
a,b,c,d = a-1,b-1,c-1,d-1 
s = input()
k = 0
swappable = False
possible = True




for i in range(a, max(c,d)):
    j = s[i]
    if j=='
        if (k==0) and ((a<i<c) or (b<i<d)):
            possible = False
            break
        k = 0
    if j=='.':
        k += 1
        if (k>=3) and (b<i<=(d+1)):
            swappable = True
    

if (c>d) and (not swappable):
    possible = False

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

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, A, B, C, D = MAP()

S = input()

if S[A:max(C, D)].count("
    print("No")
    exit()

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

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

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

flag = True
for i in range(A, C):
    if S[i] == "
        flag = False
        break
else:
    for i in range(B, D):
        if S[i] == "
            flag = False
            break

if flag:
    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")
                break
        else:
            print("No")
else:
    print("No")

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


if __name__ == "__main__":
  main()

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

a = A-1
b = B-1
c = C-1
d = D-1

ans = 1

for i_a in range(a,C):
  
  if S[i_a] == "
    if S[i_a+1] == "
      ans =0

for i_b in range(b,D):
  
  if S[i_b] == "
    if S[i_b+1] == "
      ans =0

if D < C:
  ans = 0
  for i in range(b,D):
    
    if S[i-1] == ".":
      if S[i] == ".":
        if S[i+1] == ".":
          ans = 1

if ans ==1:
  print("Yes")
else:
  print("No")

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

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

res = 'Yes'

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

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

print(res)

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):
N,A,B,C,D = map(int,input().split())
S=input()
ans="Yes"

if D<C:
  triple = S[B-2:D+1].count("...")
  if triple ==0:
    ans="No"

double= S[A-1:max(C,D)].count("
if double > 0:
  ans="No"
  
print(ans)

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

cant = False
if c>d:
        cant = True
        for i in range(max(0,b-2), min(d-1, n-2)):
                if s[i]==s[i+1]==s[i+2]=='.': cant = False

for i in range(b-1, d-1):
        if s[i]==s[i+1]=='
for i in range(a-1, c-1):
        if s[i]==s[i+1]=='

print("YNeos"[cant::2])

Solution (Python):
from collections import deque

def solve():
    n,a,b,c,d = map(int,input().split())
    s = input()
    
    flag1 = True
    
    flag2 = True
    
    flag3 = False
    cnt = 0
    for i in range(a-1,c):
        if s[i]=='
            cnt+=1
        else:
            cnt=0
        if cnt>=2:
            flag1 = False
    cnt=0
    for i in range(b-1,d):
        if s[i]=='
            cnt+=1
        else:
            cnt=0
        if cnt>=2:
            flag2 = False
    l = max(a,b)
    r = min(c,d)
    if r<n and s[r]!='
        r+=1
    if l-2>=0 and s[l-2]!='
        l-=1
    for i in range(l-1,r):
        if s[i]=='.':
            cnt+=1
        else:
            cnt=0
        if cnt>=3:
            flag3 = True

    if flag1 and flag2:
        if c<d:
            print('Yes')
        else:
            if flag3:
                print('Yes')
            else:
                print('No')
    else:
        print('No')
        
if __name__ == "__main__":
    solve()

Solution (Python):



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


is_ok = True


if C>D:
    
    if "
        is_ok = False

    
    if "
        is_ok = False
else:
    
    if "
        is_ok = False

    
    if "
        is_ok = False


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

Solution (Python):
from collections import deque
def solve():
    n,a,b,c,d = map(int,input().split())
    s = input()
    
    flag1 = True
    
    flag2 = True
    
    flag3 = False
    cnt = 0
    for i in range(a-1,c):
        if s[i]=='
            cnt+=1
        else:
            cnt=0
        if cnt>=2:
            flag1 = False
    cnt=0
    for i in range(b-1,d):
        if s[i]=='
            cnt+=1
        else:
            cnt=0
        if cnt>=2:
            flag2 = False
    l = max(a,b)
    r = min(c,d)
    if r<n and s[r]!='
        r+=1
    if l-2>=0 and s[l-2]!='
        l-=1
    for i in range(l-1,r):
        if s[i]=='.':
            cnt+=1
        else:
            cnt=0
        if cnt>=3:
            flag3 = True

    if flag1 and flag2:
        if c<d:
            print('Yes')
        else:
            if flag3:
                print('Yes')
            else:
                print('No')
    else:
        print('No')
if __name__ == "__main__":
    solve()

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

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


resolve()

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

Solution (Python):
import sys
input = sys.stdin.readline
N, A, B, C, D = map(int, input().split())
S = list(input())[: -1]
tri = 0
for i in range(min(A, B) - 1, max(C, D) - 1):
  if S[i] == "
    print("No")
    exit(0)
for i in range(max(A, B) - 1, min(C, D)):
  if S[i] == "." and (S[i - 1] == ".") and (S[i + 1] == "."): tri = 1
if C <= D:
  print("Yes")
else:
  if tri: print("Yes")
  else: print("No")

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

def check_one_people_can(start, end):
    s = S[start+1: end]
    before_sharp = False
    for x in s:
        if x == "
            if before_sharp:
                return False
            before_sharp = True
        else:
            before_sharp = False
    return True

def check_triple_dots(start, end):
    s = S[start-1: end+2]
    continuous_dots = 0
    for x in s:
        if x == ".":
            continuous_dots += 1
            if continuous_dots == 3:
                return True
        else:
            continuous_dots = 0
    return False

if D > C:
    if check_one_people_can(A, C) and check_one_people_can(C, D):
        print("Yes")
    else:
        print("No")
else:
    if check_triple_dots(B, D) and check_one_people_can(A, C):
        print("Yes")
    else:
        print("No")

Solution (Python):
def main():
    N, a, b, c, d = (int(i) for i in input().split())
    S = input()
    if "
        return print("No")
    if c < d:
        return print("Yes")
    
    if "..." in S[b-2:d+1]:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]

n, a, b, c, d = MAP()
s = STR()

dp1 = [inf for _ in range(n + 1)]
dp1[a] = 0
dp1[a - 1] = 0
for i in range(a + 1,c + 1):
    if s[i - 1] == '.':
        dp1[i] = min(dp1[i - 1], dp1[i - 2]) + 1
dp2 = [inf for _ in range(n + 1)]
dp2[b] = 0
dp2[b - 1] = 0
for i in range(b + 1, d + 1):
    if s[i - 1] == '.':
        dp2[i] = min(dp2[i - 1], dp2[i - 2]) + 1

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

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

def isOk(fr, to):
    if S[fr: to + 1].count('
        return False
    return True

if not (isOk(A, C) and isOk(C, D)):
    print('No')
    exit()

def canSwitch():
    if S[max(A, B) - 1: min(C, D) + 2].count('...'):
        return True
    return False

if A < B and D < C or B < A and C < D:
    if not canSwitch():
        print('No')
        exit()

print('Yes')

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

def isOk(fr, to):
    if S[fr: to + 1].count('
        return False
    return True

if not (isOk(A, C) and isOk(C, D)):
    print('No')
    exit()

def canSwitch():
    if A + 1 == B and D < C and S[A: A + 3] == '...':
        return True
    if B + 1 == A and C < D and S[B: B + 3] == '...':
        return True
    if C + 1 == D and B < A and S[C - 1: D + 1] == '...':
        return True
    if D + 1 == C and A < B and S[D - 1: C + 1] == '...':
        return True
    if A < B and S[B - 1: B + 2] == '...':
        return True
    if B < A and S[A - 1: A + 2] == '...':
        return True
    if C < D and S[C - 1: C + 2] == '...':
        return True
    if D < C and S[D - 1: D + 2] == '...':
        return True
    if S[max(A, B): min(C, D) + 1].count('...'):
        return True
    return False

if A < B and D < C or B < A and C < D:
    if not canSwitch():
        print('No')
        exit()

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):
N,A,B,C,D = map(int, input().split())
S = [""] + list(input()) + [""]

def can(start, end):
    for i in range(start, end):
        if S[i] == S[i + 1] == "
            return False
    return True

def main():
    if not (can(A, C) and can(B, D)):
        return False

    if C < D:
        return True
    elif C > D:
        for i in range(B, D + 1):
            if S[i - 1] == S[i] == S[i + 1] == ".":
                return True
        return False

if __name__ == "__main__":
    if main():
        print('Yes')
    else:
        print('No')

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

if "
    print("No")
    exit()
elif "
    print("No")
    exit()

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

print("Yes")

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

if c<d:
    if s[a-1:d].find("
        print("No")
    else:
        print("Yes")

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