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

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


main()

Solution (Python):
import bisect,copy,heapq,itertools,string
from collections import *
from math import *
import sys
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

n, a, b, c, d = MAP()
s = 'a' + input()

flag = 0
for i in range(min(a,b)+1,max(c,d)):
        if (a < i < c or b < i < d) and s[i] == s[i-1] == '
                print("No")
                exit()       
        elif max(a,b) <= i <= min(c,d) and s[i-1] == s[i] == s[i+1] == '.':
                flag = 1

if c > d and flag == 0:
        print("No")
else:
        print("Yes")

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


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


if not iwa_check(a, c) or not iwa_check(b, d):
    print('No')
    exit()


if c > d:
    ok = False
    for i in range(b, d + 1):
        if s[i - 1] == '.' and s[i] == '.' and s[i + 1] == '.':
            ok = True
            break
    if not ok:
        print('No')
        exit()


print('Yes')

Solution (Python):
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0

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

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

    print('No')


if __name__ == "__main__":
    main()

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

if a > b and c > d or a < b and c < d:
  if s[a - 1:c].count('
    print('Yes')
  else:
    print('No')
else:
  i, j = (b, d) if a < b else (a, c)
  if any(s[k - 1] == s[k] == s[k + 1] == '.' for k in range(i - 1, j)):
    print('Yes')
  else:
    print('No')

Solution (Python):
import sys
N, A, B, C, D = map(int, input().split())
s = input()
if C < D:
    for x, y in zip(s[A:], s[A+1:D]):
        if x == '
            print('No')
            sys.exit()
    print('Yes')
else:
    for x, y in zip(s[A:], s[A+1:C]):
        if x == '
            print('No')
            sys.exit()
    for x, y, z in zip(s[B-2:], s[B-1:], s[B:D+1]):
        if x == '.' and y == '.' and z == '.':
            print('Yes')
            sys.exit()
    print('No')

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

    if("
    if(d>c):
        return 1
    else:
        if("..." in s[b-2:d+1]):
            return 1
        else:
            return 0

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

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

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

Solution (Python):
import sys
N, *AB = [int(x) for x in input().split()]
As, Bs, Ag, Bg = map(lambda x : x - 1, AB)
S = input()
for (s, g) in [(As, Ag), (Bs, Bg)]:
    if '
        print("No")
        sys.exit()

if Bg < Ag:  
    if '...' not in S[Bs - 1 : Bg + 2]:
        print("No")
        sys.exit()

print("Yes")

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

def linput(ty=int, cvt=list):
	return cvt(map(ty,input().split()))

def gcd(a: int, b: int):
	while b: a, b = b, a%b
	return a

def lcm(a: int, b: int):
	return a * b // gcd(a, b)

def main():
	n,a,b,c,d = linput()
	S = "_" + input().rstrip()
	
	res = 1
	
	X = S[a:c].count("
	X += S[b:d].count("
	if X!=0: res=0
	
	if c>d:
		Y = S[b-1:d+2].count("...")
		if Y==0: res=0
	
	sT = "No Yes".split()
	print(sT[res])

if __name__ == "__main__":
	main()

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

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

count = 0
for i in range(B-1,D):
  if D != len(S): 
    if S[i] == "." and S[i-1] == "." and S[i+1] == ".":
      print("Yes")
      exit()
print("No")

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

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

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

g = groupby(s[a:c])
h = groupby(s[b:d])

for i, j in g:
    if i == "
        print("No")
        exit()

for i, j in h:
    if i == "
        print("No")
        exit()

if c < d:
    print("Yes")
    exit()

e = groupby(s[b-2:d+1])
for i, j in e:
    if i == "." and len(list(j)) > 2:
        print("Yes")
        exit()

print("No")

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees
from itertools import accumulate, permutations, combinations, combinations_with_replacement, 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, insort, insort_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 1 <= S[A:max(C, D)].count("
	print("No")
elif C < D:
	print("Yes")
else:
	if 1 <= S[B-2:D+1].count("..."):
		print("Yes")
	else:
		print("No")

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees
from itertools import accumulate, permutations, combinations, combinations_with_replacement, 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, insort, insort_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 = list(input())

def cango(a, b):
	for i in range(a, b):
		if S[i] == "
			return False
			break
	else:
		return True

if C < D:
	if cango(A-1, C-1) and cango(B-1, D-1):
		print("Yes")
	else:
		print("No")

else:
	for i in range(B-2, D-1):
		if S[i] == S[i+1] == S[i+2] == ".":
			S[i+1] = "
			break
	else:
		print("No")
		exit()

	if cango(A-1, C-1):
		print("Yes")
	else:
		print("No")

Solution (Python):
n,a,b,c,d=map(int,input().split())
s=str(input())
s=list(s)
cnts=0
cnti=0
space=0
iwa=0
temp=0
next=0
if c<d:
  for i in range(a-1,d):
    if s[i]==".":
      cnts=cnts+1
      space=max(space,cnts)
      cnti=0
    else:
      cnti=cnti+1
      iwa=max(iwa,cnti)
      cnts=0
  if iwa>1:
    print("No")
  else:
    print("Yes")
else:
  for i in range(a-1,c):
    if s[i]==".":
      if i<=b-2:
        cnts=0
      cnts=cnts+1
      space=max(space,cnts)
      cnti=0
    else:
      cnti=cnti+1
      iwa=max(iwa,cnti)
      cnts=0
    if i==d-1:
      temp=space
      if s[i-1]=="." and s[i+1]==".":
        next=1
  if iwa>1:
    print("No")
  elif temp<3 and next==0:
    print("No")
  else:
    print("Yes")

Solution (Python):
import re
n, a, b, c, d = map(int, input().split())
road = input()
if c < d:
    if re.search('
        print('Yes')
    else:
        print('No')
 
elif c > d:
    if re.search('
        print('Yes')
    else:
        print('No')

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

flg = True
if A < B and C > D:
    flg = False
    for i in range(B-2, D-1):
        if S[i:i+3] == "...":
            flg = True
            break
if A > B and C < D:
    flg = False
    for i in range(A-2, C-1):
        if S[i:i+3] == "...":
            flg = True
            break
for i in range(A-1, C-2):
    if S[i:i+2] == "
        flg = False
        break
for i in range(B-1, D-2):
    if S[i:i+2] == "
        flg = False
        break

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

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

elif c > d:
    if re.search('
        print('Yes')
    else:
        print('No')

Solution (Python):



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

    ret = 'No'
    if C<D:
        pathBtoD=S[B-1:D]
        pathAtoC=S[A-1:C]
        if pathBtoD.find('
            ret = 'Yes'
    else:
        pathBtoD=S[B-1:D]
        pathAtoC=S[A-1:C]
        pathBtoD2 = S[B-2:D+1]
        if pathBtoD.find('
            if pathBtoD2.find('...')!=-1:
                ret = 'Yes'
    print(ret)

if __name__ == '__main__':
    main()

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

Solution (Python):
import sys
from collections import defaultdict

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

s='_'+input()

ans=['Yes','No']



def CanGo(x,y):
    cnt=0
    root=s[x:y]
    for c in root:
        if c=='
            cnt+=1
        elif c=='.':
            if cnt>2:
                return False
            cnt=0
    return True


def CanPass(x,y):  
    root=s[x-1:y+2]
    '''
    q=s[x-1:x+2]
    print(root,q)
    print(root,len(root)-3+1)
    for i in range(len(root)-3+1):
        if q=='...':
            return True
        q=q[1:3]+s[x+3+i]
    '''
    if root.find('...')!=-1:
        return True
    return False
        


if c<d:
    if CanGo(b,d) and CanGo(a,c):
        ai=0
    else:
        ai=1
elif c>d:
    if CanGo(b,d) and CanGo(a,c) and CanPass(b,d):
        ai=0
    else:
        ai=1
    
    

print(ans[ai])

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

from sys import exit


goal = max(C, D)
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()

from sys import exit


goal = max(C, D)
if "
    print("No")
    exit()

if C < D:
    
    print("Yes")

else:
    

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

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

from itertools import groupby 

gr = groupby(s)


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

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


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

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

def move(a,s):
    ar = a
    while(ar<n-2):
        if(s[ar+2]=='.'):
            ar += 2
        elif(s[ar+1]=='.'):
            ar +=1
        else:
            break
    if(ar!=n-1):
        ar+=(s[ar+1]=='.')
    return ar

def pr_end(x):
    if(x):
        print('Yes')
    else:
        print('No')
    exit()

ar = move(a,s)
br = move(b,s)

if(c<d):
    if(c<=ar)&(d<=br):
        pr_end(1)
    else:
        pr_end(0)

for i in range(b-1,d):
    if(s[i:i+3] =='...'):
        if(c<=ar)&(d<=br):
            pr_end(1)
        else:
            pr_end(0)

pr_end(0)

Solution (Python):






import sys
input = sys.stdin.readline

import math

import bisect
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache






MOD = 10**9+7
INF = float('inf')






def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]


def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()


def DD(arg): return defaultdict(arg)



def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


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 make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors


def make_primes(N):
  max = int(math.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd (a, b)


def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count


def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))


def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count




N,A,B,C,D = IL()
S = S()

dA = [0 for i in range(N)]
dB = [0 for i in range(N)]

dA[A-1] = 1
dB[B-1] = 1

q = deque([A-1])
while q:
  x = q.pop()
  for i in [-2,-1,1,2]:
    nx = x+i
    if 0<=nx<N:
      if dA[nx] == 0 and S[nx]==".":
        dA[nx] = 1
        q.append(nx)

q = deque([B-1])
while q:
  x = q.pop()
  for i in [-2,1,1,2]:
    nx = x+i
    if 0<=nx<N:
      if dB[nx] == 0 and S[nx]==".":
        dB[nx] = 1
        q.append(nx)

if dA[C-1] == dB[D-1] == 1:
  if C<D:
    print("Yes")
  else:
    count = 0
    MAX = 0
    prev = 0
    for c in dB[B-2:min(D+1,N-1)]:
      if c == 1:
        if prev == 1:
          count += 1
          MAX = max(MAX,count)
        else:
          count = 1
      prev = c
    if MAX >= 3:
      print("Yes")
    else:
      print("No")
else:
  print("No")

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

goal = max(C,D)
if '
  print("No")
  exit()

ok = True

if D < C:
  
  if ('...' in S[B-1:D]) or ('...' in S[B-2:B+1]) or ('...' in S[D-2:D+1]):
    ok = True
  else:
    ok = False


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

Solution (Python):
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction



mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def l(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]







N,A,B,C,D=l()
S=input()
if '
    print('No')
    quit()
 
if C < D:
    print('Yes')
else:
    if '...' in S[B-2:D+1]:
        print('Yes')
        quit()
    print('No')

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





if '
    print('No')
    quit()

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

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

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

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

s=input()

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

Solution (Python):
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline



def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    n, a, b, c, d = geta(int)
    s = "

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

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


if __name__ == "__main__":
    main()

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

s = input()

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

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

if c < d:
    if s[a-1:c].find('
        print('Yes')
    else:
        print('No')
else:
    if s[a-1:c].find('
        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:
        if "..." in s[B-2:D+1]:
            print("Yes")
        else:
            print("No")
else:
    if "
        print("No")
    else:
        print("Yes")

Solution (Python):
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7

INF = 10**18
eps = 10**-7

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

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

Solution (Python):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))

n,a,b,c,d = iim()
s = input()
st = s[b-2:min(c,d)+1]
s = s[a-1:max(c,d)]

if '
    print('No')
elif c < d:
    print('Yes')
else:
    print('Yes' if '...' in st else ' No')

Solution (Python):
def main():
    import sys
    input = sys.stdin.readline
    N, A, B, C, D = [int(x) for x in input().strip().split()]
    A, B, C, D = A-1, B-1, C-1, D-1
    S = input().strip()
    if C == D:
        print('No')
        return
    if C > D:
        C, D = D, C
        A, B = B, A
    while B != D:
        
        
        
        if B + 2 < N and B + 2 != A and S[B+2] == '.':
            B += 2
        elif B + 1!= A and S[B+1] == '.':
            B += 1
        else:
            if A > B:
                if A + 1 < N and B != A + 1 and S[A+1] == '.':
                    A += 1
                elif A + 2 < N and B != A + 2 and S[A+2] == '.':
                    A += 2
                else:
                    print('No')
                    return
            else:
                print('No')
                return
    
        
    while A != C:
        
        
        
        if A + 2 < N and B != A + 2 and S[A+2] == '.':
            A += 2
        elif A + 1 < N and B != A + 1 and S[A+1] == '.':
            A += 1
        else:
            print('No')
            return

    
    
    
    print('Yes')



if __name__ == '__main__':
    main()

Solution (Python):
import re

N, A, B, C, D = map(int, input().split())
S = input()
S = '
flag = True
if re.search(r'
    flag *= False

if D < C:
    if re.search(r'\.\.\.', S[B-1:D+2]):
        flag *= True
    else:
        flag *= False
        
print('Yes') if flag else print('No')

Solution (Python):

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

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

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

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

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

Solution (Python):
def main():
    n, a, b, c, d = list(map(lambda x: int(x) - 1, input().split()))
    n += 1
    s = list(input())
    s = s[a:max(c, d) + 1]
    for i in range(len(s) - 1):
        if s[i] == '
            print('No')
            exit()
    if c < d:
        print('Yes')
    else:
        ch = False
        for i in range(b, d + 1):
            if s[i - 1] == s[i] == s[i + 1] == '.':
                ch = True
        if ch:
            print('Yes')
        else:
            print('No')

if __name__ == '__main__':
    main()

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

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


def log(*args):
    print(*args, file=sys.stderr)


def main():
    N, A, B, C, D = map(int, input().split())
    log(N, A, B, C, D)
    S = input()
    if "
        print("No")
        return
    if C < D:
        print("Yes")
        return
    log(S[B-2:D+1])
    if "..." in S[B-2:D+1]:
        print("Yes")
        return
    print("No")


if __name__ == '__main__':
    main()

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


def move_snuke():
    global A, B
    if B == D:
        return False
    if S[B + 1] == '.' and A != B + 1:
        B += 1
        return True
    if S[B + 2] == '.' and A != B + 2:
        B += 2
        return True
    return False


def move_fnuke():
    global A, B
    if A == C:
        return False
    if S[A + 1] == '.' and B != A + 1:
        A += 1
        return True
    if S[A + 2] == '.' and B != A + 2:
        A += 2
        return True
    return False


S = '
while True:
    if C < D:
        if not move_snuke():
            if not move_fnuke():
                print('No')
                break
    else:
        if not move_fnuke():
            if not move_snuke():
                print('No')
                break
    if A == C and B == D:
        print('Yes')
        break

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

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

Solution (Python):
import fractions
import sys
from functools import reduce
import math

input = sys.stdin.readline


def main():
    n, a, b, c, d = input_list()
    s = input()
    uses = s[a-1:d]
    if '
        print('No')
        exit()
    if c < d:
        print('Yes')
    else:
        end = d+1 if d < len(s) else d
        if '...' in s[b-2:end]:
            print('Yes')
        else:
            print('No')


def get_camulative(l):
    import itertools
    
    return [0] + list(itertools.accumulate(l))

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


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


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


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


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


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


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


if __name__ == "__main__":
    main()

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

if s[c] == '
    print('No')
    exit()


if '
    print('No')
    exit()

if c > d:
    
    num_dot = s[b-1:d+2].count("...")
    if num_dot == 0:
        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(0)

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

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

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):
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

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

def find_route(X,Y):
    for i in range(X,Y):
        if S[i] == S[i + 1] == '
            return False
    return True

if C < D:
    if find_route(A,C) and find_route(B,D):
        print('Yes')
    else:
        print('No')
else:
    flag = False
    for i in range(B - 1,D):
        if S[i] == S[i + 1] == S[i + 2] == '.':
            flag = True
            break
    if flag and find_route(A,C):
        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 '
    print('No')
  else:
    print('Yes')

Solution (Python):
n, a, b, c, d = map(int, input().split())
s = input()
flag1, flag2 = False, False
if d > c:
    flag = "
else:
    flag = "..." in s[b - 2: d + 1]

print("Yes" if flag else "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")