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=list(input())
a=0
E=N-D
if C>D:
    for i in range(N-3):
        if S[i]=="
            for j in range(1,4):
                if S[i]==S[i+j]:
                    a=1
    if E==0:
        for i in range(B-2,D-2):
            if S[i]==".":
                if S[i]==S[i+1] and S[i+1]==S[i+2]:
                    a=0
                    break
    if E>=1:
        for i in range(B-2,D-1):
            if S[i]==".":
                if S[i]==S[i+1] and S[i+1]==S[i+2]:
                    a=0
                    break
for i in range(A,D):
    if S[i]=="
        if S[i+1]=="
            a=1
if a==0:
    print("Yes")
if a==1:
    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):
import sys
INPUT = sys.stdin.readline

def SINGLE_INT(): return int(INPUT())
def MULTIPLE_INT_LIST(): return list(map(int, INPUT().split()))
def MULTIPLE_INT_MAP(): return map(int, INPUT().split())
def SINGLE_STRING(): return INPUT()
def MULTIPLE_STRING(): return INPUT().split()

N, A, B , A_goal, B_goal = MULTIPLE_INT_MAP()
S = SINGLE_STRING()

def surpass():

    if '...' in S[B-2:B_goal+1]:
        return 'Yes'
    else:
        return 'No'


if '
    print('No')

else:
    if A_goal < B_goal:
        print('Yes')
    else:
        print(surpass())

Solution (Python):
import sys


def input():
    return sys.stdin.readline()[:-1]


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

    if "
        print("No")
        sys.exit()

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

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


if __name__ == "__main__":
    main()

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


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

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

sunuke_possible = "
funuke_possible = "

if C > D:
    passing = "..." in S[B - 1:D + 2]
    possible = sunuke_possible * funuke_possible * passing
else:
    possible = sunuke_possible * funuke_possible

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

Solution (Python):
l = list(map(int,input().split()))
N = l[0]
A = l[1] 
B = l[2]
C = l[3]
D = l[4]
S = input()
S_list = list(S)

if B < C < D :
    count = 0
    for i in range(A, D-2):
        if S_list[i] == S_list[i+1] == '
            count += 1
    if count >= 1:
        print('No')
    else : 
        print('Yes')
elif C < B < D :
    count = 0
    for i in range(A, C-2):
        if S_list[i] == S_list[i+1] == '
            count += 1
    for j in range(B, D-1):
        if S_list[j] == S_list[j+1] == '
            count += 1
    if count >= 1:
        print('No')
    else :
        print('Yes')
elif B < D < C:
    count = 0
    for i in range(A, C-2):
        if S_list[i] == S_list[i+1] == '
            count += 1

    cou = 0
    for i in range(B-2, D-1):
        if S_list[i] == S_list[i+1] == S_list[i+2] == '.' :
            cou += 1
    if cou >= 1 and count < 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):
N ,A ,B ,C ,D = list(map(int,input().split()))
S = input()
 
def judgeArrive(S, x, y):
    flag = "Yes"
    for i in range(x-1 ,y-2):
        if S[i] ==  S[i+1] == "
            flag = "No"
    return flag

def judgeJumpOver(S, x , y):
    flag = "No"
    for i in range(x-1 ,y):
        if S[i-1] ==  S[i] ==  S[i+1] == ".":
            flag = "Yes"
            break
    return flag
 
result = "Yes"
if(C > D):
    result = judgeJumpOver(S, B, D)
if(result == "Yes"):
    result = judgeArrive(S, B, D)
if(result == "Yes"):
    result = judgeArrive(S, A, C)
print(result)

Solution (Python):
N ,A ,B ,C ,D = list(map(int,input().split()))
S = input()
 
def judgeArrive(S, x, y):
    flag = "Yes"
    for i in range(x-1 ,y-2):
        if S[i] ==  S[i+1] == "
            flag = "No"
    return flag

def judgeJumpOver(S, x , y):
    flag = "No"
    for i in range(x-1 ,y):
        if S[i-1] ==  S[i] ==  S[i+1] == ".":
            flag = "Yes"
            break
    return flag
 
result = "Yes"
if(C > D):
    result = judgeJumpOver(S, B, D)
if(result == "Yes"):
    result = judgeArrive(S, B, D)
if(result == "Yes"):
    result = judgeArrive(S, A, C)
print(result)

Solution (Python):
N ,A ,B ,C ,D = list(map(int,input().split()))
S = input()
 
def judgeArrive(S, x, y):
    flag = "Yes"
    for i in range(x-1 ,y-2):
        if S[i] ==  S[i+1] == "
            flag = "No"
    return flag

def judgeJumpOver(S, x , y):
    flag = "No"
    for i in range(x-1 ,y):
        if S[i-1] ==  S[i] ==  S[i+1] == ".":
            flag = "Yes"
            break
    return flag
 
result = "Yes"
if(C > D):
    result = judgeJumpOver(S, B, D)
if(result == "Yes"):
    result = judgeArrive(S, B, D)
if(result == "Yes"):
    result = judgeArrive(S, A, C)
print(result)

Solution (Python):
N ,A ,B ,C ,D = list(map(int,input().split()))
S = input()
 
def judgeArrive(S, x, y):
  flag = "Yes"
  for i in range(x-1 ,y-2):
    if S[i] ==  S[i+1] == "
        flag = "No"
  return flag

def judgeJumpOver(S, x , y):
  flag = "No"
  for i in range(x-1 ,y):
    if S[i-1] ==  S[i] ==  S[i+1] == ".":
      flag = "Yes"
      break
 
  return flag
 
result = "Yes"
if(C > D):
  result = judgeJumpOver(S, B, D)
if(result == "Yes"):
  result = judgeArrive(S, B, D)
if(result == "Yes"):
  result = judgeArrive(S, A, C)
print(result)

Solution (Python):
N ,A ,B ,C ,D = list(map(int,input().split()))
S = input()
 
def judgeArrive(S, x, y):
  flag = "Yes"
  for i in range(x-1 ,y-2):
    if S[i] ==  S[i+1] == "
        flag = "No"
  return flag

def judgeJumpOver(S, x , y):
  flag = "No"
  for i in range(x-1 ,y):
    if S[i-1] ==  S[i] ==  S[i+1] == ".":
      flag = "Yes"
      break
 
  return flag
 
result = "Yes"
if(C > D):
  result = judgeJumpOver(S, B, D)
if(result == "Yes"):
  result = judgeArrive(S, B, D)
if(result == "Yes"):
  result = judgeArrive(S, A, C)
print(result)

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

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

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

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

Solution (Python):
N,A,B,C,D = map(int,input().split())
S = input()
 
def step(x,y):
    N_last = S[x:y-1]
    return N_last.find('

Ans = step(A,C) and step(B,D)
 
if C > D:
    pass_path = False
    for b in range(B-1,D):
        if S[b] == '
            continue
        if S[b-1] == '.' and S[b+1] == '.':
            pass_path = True
            break
    Ans = step(A,C) and step(B,D) and  pass_path


if Ans == True:
    print('Yes')
else:
    print('No')

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

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

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

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

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

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

Solution (Python):
N,A,B,Q,D = map(int,input().split())
S = input()
C = []
for i in range(len(S)):
    C.append(S[i])

if Q<D:
    error = 0
    for i in range(A,D-1):
        if C[i]=="
            error = 1
            break
else:
    error = 0
    for i in range(B,D-1):
        if C[i]=="
            error = 1
            break
    flag = 0
    for i in range(B-1,D):
        if C[i-1]=="." and C[i+1]=="." and C[i]==".":
            flag = 1
    if flag==0:
        error = 1

if error==0:
    print("Yes")
else:
    print("No")

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

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

Solution (Python):

N,A,B,C,D=map(int,input().split())
S=input()
if C<D:
    Slist=S[A-1:D].split(".")
    if S[A-1:D].count("
        print("Yes")
    else:
        print("No")
else:
    if S[A:B-1].split(".").count("
        print("No")
    else:
        if S[B-2:D+1].split("
        +S[B-2:D+1].split("
        ==S[B-2:D+1].count("."):
            print("No")
        else:
            print("Yes")

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

Solution (Python):
import sys

stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

N, A, B, C, D = read_int()
S = read_str()

def solve():
    can_reach = not ('
    is_comma_suc3 = '...' in S[B - 2 : D + 1]
    if C < D:
        return "Yes" if can_reach else "No"
    else:
        return "Yes" if is_comma_suc3 and can_reach else "No"

if __name__ == "__main__":
    print(solve())

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

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 = list(map(lambda x: int(x),input().split()))
S = " "+input()
def isAble():
    if "
        return "No"
    if C>D:
        if "..." not in S[B-1:D+2]:
            return "No"
    return "Yes"

print(isAble())

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

for i in range(D-A):
  if (road[A+i-1] == '
    judge = 0
    break
  else:
    judge = 1
if judge == 1:
  if C < D:
    judge = 1
  else:
    for i in range(D-B+1):
      if (road[B+i-2] == '.') & (road[B+i-1] == '.') & (road[B+i] == '.'):
        judge = 1
        break
      else:
        judge = 0

if judge == 0:
  print("No")
else:
  print("Yes")

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

for x in S[A:max(C, D)-1].split("."):
    if len(x) > 1:
        print("No")
        sys.exit()
    else:
        pass

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

for x in S[B-2:D+1].split("
    if len(x) > 2:
        print("Yes")
        sys.exit()
    else:
        pass

print("No")

Solution (Python):

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

S = input()




flag = True

for i in range(C-A):

    i += A
    i -= 1

    if S[i] == "
        flag = False

for i in range(D-B):

    i += B
    i -= 1

    if S[i] == "
        flag = False

flag2 = True

if C > D:

    flag2 = False

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

        i += B-1
        i -= 1

        if S[i] == "." and S[i+1] == "." and S[i+2] == ".":
            flag2 = True

        

if flag and flag2:
    print ("Yes")

else:
    print ("No")

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

Z = True

for i in range ( A, C-3):
  if (b[i] is "
    Z = False
    break

if Z:    
  for i in range ( B, D-3):
    if (b[i] is "
      Z = False
      break
    
if Z and ( C > D):
  for i in range ( B-1, D):
    if (b[i-1] is ".") and (b[i] is ".") and (b[i+1] is "."):
      Z = True
      break
    else :
      Z = False
      
if Z:
  print("Yes")
  
if not Z:
  print("No")

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

if "
    print("No")
elif "
    print("No")
elif d < c :
    if "..." in 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=input()+"."
if c<d or (c>d and "..." in s[b-2:d+1]):
    if "
        print("Yes")
    else:
        print("No")
else:
    print("No")

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

Solution (Python):
def check_double_block(start, end, S):
    for i in range(start, end):
        if S[i] == "
            return False
    return True

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

    S = "

    if C < D:
        if not check_double_block(A, C, S) or not check_double_block(B, D, S):
            print("No")
        else:
            print("Yes")
    else:
        for i in range(B, D+1):
            if S[i-1] == "." and S[i] == "." and S[i+1] == ".":
                print("Yes")
                exit()
        print("No")


if __name__ == '__main__':
    main()

Solution (Python):


import sys

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

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

Solution (Python):
def solve():
    N,A,B,C,D = [int(s)-1 for s in input().split() if s]
    S = input()
    N += 1
    
    flag = True
    for i in range(A+1, max(C,D)-1):
        if S[i] == '
            flag = False
    
    if flag and C > D:
        flag = False
        for i in range(B-1, D):
            if S[i] == '.' and S[i+1] == '.' and S[i+2] == '.':
                flag = True
    
    print('Yes' if flag else 'No')

solve()

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

def check(s, a, b):
    return not "


def solve(s,a,b,c,d):
    can_swap = "..." in s[b - 1:d + 2]
    can_reach_each = check(s, a, c) and check(s, b, d)
    if not can_reach_each:
        return False
    if (a < b and c < d) or (b < a and d < c):
        return True
    else:
        if can_swap:
            return True
        else:
            return False

if solve(s, a, b, c, d):
    print("Yes")
else:
    print("No")

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

def check(l, r):
    return "

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

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

def check(l, r):
    for i in range(l, r):
        if s[i] == '
            return False

    return True

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

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

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

Solution (Python):
import sys
from collections import deque
sys.setrecursionlimit(100000)
input = sys.stdin.readline

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

def able(m, n, S):
    for i in range(m+1, n):
        if S[i] == '
            return False
    return True

def able2(m, n, S):
    if not able(m, n, S):
        return False
    for i in range(m, n+1):
        if S[i] == '.' and S[i-1] == '.' and S[i+1] == '.':
            return True
    return False

if C>D:
    if able(A-1, C-1, S) and able2(B-1, D-1, S):
        print("Yes")
    else:
        print("No")
else:
    if able(A-1, C-1, S) and able(B-1, D-1, S):
        print("Yes")
    else:
        print("No")

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

S = list(input())

iwa2 = []
cnt = 0
for i in range(len(S)-1):
    if S[i] == S[i+1] == "

        cnt += 1


    iwa2.append(cnt)
    

iwa2.append(cnt)        
        
def iwa2_check(s,g):
    if iwa2[s] < iwa2[g]:
        return True
    return False


aki3 = [0]
cnt = 0
for i in range(1,len(S)-1):
    if S[i-1] == S[i] == S[i+1] == ".":
        cnt += 1
    aki3.append(cnt)
aki3.append(cnt)

def aki3_check(B,CORD):
    


    
    
    if aki3[B-1] < aki3[CORD]:
        return True
    return False


def solve():
    if iwa2_check(A,C) or iwa2_check(B,D):

        return False
    if C<D:

        return True
    else:
        if aki3_check(B, D):

            return True
        else:

            return False

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

Solution (Python):
nabcd = input().split()
n = int(nabcd[0])
a = int(nabcd[1])
b = int(nabcd[2])
c = int(nabcd[3])
d = int(nabcd[4])

course = input()

if '
  print('No')

else:
  if c > d:
    if not '...' in course[b-2:d+1]:
      print('No')
    elif (not '...' in course[b-2:d-1]) and course[d-2]=='
      print('No')
    else:
      print('Yes')
  else:
    print('Yes')

Solution (Python):

def main():
    N,A,B,C,D = list(map(int,input().split()))
    S = input()
    A -=1
    B -=1
    C -=1
    D -=1
    
    prev = -1
    if C < D:  
        
        for i in range(A+1,min(C,B)):
            if S[i] == '
                if prev == i-1:
                    print('No')
                    return
                else:
                    prev = i
        for i in range(B+1,D):
            if S[i] == '
                if prev == i-1:
                    print('No')
                    return
                else:
                    prev = i

        
        print('Yes')
    prev = -1
    if C > D:  
        for i in range(A+1,B):
            if S[i] == '
                if prev == i-1:
                    print('No')
                    return
                else:
                    prev = i
        f = False  

        prevS = -1
        prevprevS = -1

        for i in range(B-1,D+2):
            if S[i] == '
                if i - prev == 1:
                    print('No')
                    return
                prev = i
            else:
                
                if i - prevS == 1 and prevS - prevprevS ==1:
                    f = True
                prevprevS = prevS
                prevS = i
                
                
                
        
        
                
        if not f:
            print('No')
            return
        
        for i in range(D+1,C):
            if S[i] == '
                if prev == i-1:
                    print('No')
                    return
                else:
                    prev = i
        print('Yes')
if __name__ == '__main__':
    main()

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

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

Solution (Python):
N, A, B, C, D = map(int, input().split())
S = input()
s = [0]
for i in range(N):
    if S[i] == '.':
        s.append(0)
    else:
        s.append(1)
if C < B and B < D: 
    flag = 0
    for i in range(C - A):
        if s[A + i] == 1 and s[A + i + 1] == 1:
            flag = 1
            break
    if flag == 0:
        for i in range(D - B):
            if s[B + i] == 1 and s[B + i + 1] == 1:
                flag = 1
                break
    if flag == 1:
        print('No')
    else:
        print('Yes')
elif B < C and C < D: 
    flag = 0
    for i in range(D - B):
        if s[B + i] == 1 and s[B + i + 1] == 1:
            flag = 1
            break
    if flag == 0:
        for i in range(B - A):
            if s[A + i] == 1 and s[A + i + 1] == 1:
                flag = 1
                break
    if flag == 1:
        print('No')
    else:
        print('Yes')
else: 
    flag = 0
    for i in range(D - B + 1):
        if s[B + i - 1] == 0 and s[B + i] == 0 and s[B + i + 1] == 0:
            flag = 1
            break
    if flag == 1:
        for i in range(C - A):
            if s[A + i] == 1 and s[A + i + 1] == 1:
                flag = 0
                break
    if flag == 1:
        print('Yes')
    else:
        print('No')

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

flag1 = 0

for i in range(C-A-2):
    if S[i+A] == S[i+A+1] == "
        flag1 = 1
for i in range(D-B-2):
    if S[i+B] == S[i+B+1] == "
        flag1 = 1    

flag2 = 0

if (B<D) & (D<C): 
    flag2 = 1
    for i in range(D-B+1):
        if S[B-2+i] == S[B-1+i] == S[B+i] == ".":
            flag2 = 0

if (flag1 == 0) & (flag2 == 0):
    print("Yes")
else:
    print("No")

Solution (Python):
N, A, B, C, D = map(int, input().split()) 
S = [0 if s == '.' else 1  for s in input()]

if C <= B:
    ans = 'Yes'
    for i in range(A, C):
        if S[i] == 1 and S[i-1] == 1:
            ans = 'No'
            break
    for i in range(B, D):
        if S[i] == 1 and S[i-1] == 1:
            ans = 'No'
            break

elif C < D:
    ans = 'Yes'
    for i in range(A, D):
        if S[i] == 1 and S[i-1] == 1:
            ans = 'No'
            break
else:
    ans = '?'
    for i in range(A, C):
        if S[i] == 1 and S[i-1] == 1:
            ans = 'No'
            break
        if B - 1 <= i <= D - 1 and S[i] == 0 and S[i-1] == 0 and S[i+1] == 0:
            ans = 'Yes'
            break
    if ans == '?':
        ans = 'No'

print(ans)

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

Solution (Python):
def solve(n, a, b, c, d, s):
    a -= 1
    b -= 1
    c -= 1
    d -= 1
    for left, right in [(a, c), (b, d)]:
        for i in range(left, right):
            if s[i:i+2] == '
                return "No"
    if d < c:
        for i in range(b, d+1):
            if s[i-1:i+2] == "...":
                return "Yes"
        return "No"
    else:
        return "Yes"

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

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

count_dot = 0
count_sharp = 0
max_dot = 0

if(c>d):
  for i in range(a-1,c):
    if li[i]=='.':
      count_sharp = 0
      if b-2 <= i and i <= d:
        count_dot += 1
    else:
      max_dot = max(max_dot, count_dot)
      count_dot = 0
      count_sharp += 1
      if count_sharp>1:
        break
  max_dot = max(max_dot, count_dot)

  if(count_sharp<=1 and max_dot>2):
    print('Yes')
  else:
    print('No')
  
else:
  for i in range(a-1,d):
    if li[i]=='
      if not c<b:
        count_sharp += 1
        if count_sharp>1:
          break
    else:
      count_sharp = 0
  if(count_sharp<=1):
    print('Yes')
  else:
    print('No')

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

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

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

if __name__ == '__main__':
	main()

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

Solution (Python):

import bisect
from collections import defaultdict
import math

def judge(start, end, S):
    for i in range(start, end):
        s = S[i:i+2]
        if tuple(s) == ("
            return False
    return True

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

    is_ok = judge(A-1, C-1, S)
    if not is_ok:
        print("No")
        return
    is_ok = judge(B-1, D-1, S)
    if not is_ok:
        print("No")
        return

    if C > D:
        for i in range(B-1, D):
            if S[i] != "
                print("Yes")
                return
        print("No")
    else:
        print("Yes")

if __name__ == '__main__':
    main()

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

if '
    flag = 'No'
if not '...' in s[b-2:d+1] and c > d:
    flag = 'No'
print(flag)

Solution (Python):
N, A, B, C, D = map(int, input().split())
S = input()
if '
    print("No")
    exit()
swap = True if '...' in S[B-2:D+1:] else False
if C > D and not swap:
    print("No")
    exit()
print("Yes")