Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sun Jun  2 22:01:55 2019

@author: hisaki
"""

import sys
N, A, B, C, D = map(int, input().split())
S = input()
A_start = A -1
B_start = B -1
A_goal = C -1
B_goal = D -1

A_pos = A_start
B_pos = B_start

flag = True
for i in range(A_goal):
    if i< A_goal-1 and S[i] == '#':
        if S[i+1] == '#':
            flag = False

for i in range(B_goal):
    if i< B_goal-1 and S[i] == '#':
        if S[i+1] == '#':
            flag = False
if flag == False:
    print ("No")
    sys.exit()
  


if A_pos < B_pos and A_goal < B_goal:
    print ("Yes")
    sys.exit()

if B_pos < A_pos and B_goal < A_goal:
    print ("Yes")
    sys.exit()


if A_pos < B_pos and B_goal < A_goal :
    for i in range(A_goal-2):
        if (S[i] == '.' or i == A_pos or i == B_pos) and (S[i+1]== '.' or i+1 == A_pos or i+1 == B_pos ) and (S[i+2] == '.' or i+2 == A_pos or i+2 == B_pos):
            print ("Yes")
            sys.exit()

if B_pos < A_pos and A_goal < B_goal :
    for i in range(B_goal-2):
        if (S[i] == '.' or i == B_pos or i == A_pos) and (S[i+1]== '.' or i+1 == B_pos or i+1 == A_pos ) and (S[i+2] == '.' or i+2 == B_pos or i+2 = A_pos):
            print ("Yes")
            sys.exit()
            
print ("No")
        


Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sun Jun  2 22:01:55 2019

@author: hisaki
"""

import sys
N, A, B, C, D = map(int, input().split())
S = input()
A_start = A -1
B_start = B -1
A_goal = C -1
B_goal = D -1

A_pos = A_start
B_pos = B_start

flag = True
for i in range(A_pos, A_goal):
    if S[i] == '#':
        if S[i+1] == '#':
            flag = False

for i in range(B_pos, B_goal):
    if S[i] == '#':
        if S[i+1] == '#':
            flag = False
            
if flag == False:
    print ("No")
    sys.exit()
  


if A_goal < B_goal:
    print ("Yes")
    sys.exit()


if B_goal < A_goal :
    for i in range(B_pos , B_goal+1):
        if (S[i-1] == '.' or i-1 == A_pos) and (S[i]== '.') and (S[i+1] == '.'):
            print ("Yes")
            sys.exit()

            
print ("No")

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sun Jun  2 22:01:55 2019

@author: hisaki
"""

import sys
N, A, B, C, D = map(int, input().split())
S = input()
A_start = A -1
B_start = B -1
A_goal = C -1
B_goal = D -1

A_pos = A_start
B_pos = B_start

flag = True
for i in range(A_goal):
    if i< A_goal-1 and S[i] == '#':
        if S[i+1] == '#':
            flag = False

for i in range(B_goal):
    if i< B_goal-1 and S[i] == '#':
        if S[i+1] == '#':
            flag = False
if flag == False:
    print ("No")
    sys.exit()
  


if A_pos < B_pos and A_goal < B_goal:
    print ("Yes")
    sys.exit()

if B_pos < A_pos and B_goal < A_goal:
    print ("Yes")
    sys.exit()


if A_pos < B_pos and B_goal < A_goal :
    for i in range(A_goal-2):
        if (S[i] == '.' or i == A_pos or i == B_pos) and (S[i+1]== '.' or i+1 == A_pos or i+1 = B_pos ) and (S[i+2] == '.' or i+2 == A_pos or i+2 == B_pos):
            print ("Yes")
            sys.exit()

if B_pos < A_pos and A_goal < B_goal :
    for i in range(B_goal-2):
        if (S[i] == '.' or i == B_pos or i == A_pos) and (S[i+1]== '.' or i+1 == B_pos or i+1 == A_pos ) and (S[i+2] == '.' or i+2 == B_pos or i+2 = A_pos):
            print ("Yes")
            sys.exit()
            
print ("No")
        


Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sun Jun  2 22:01:55 2019

@author: hisaki
"""

import sys
N, A, B, C, D = map(int, input().split())
S = input()
A_start = A -1
B_start = B -1
A_goal = C -1
B_goal = D -1

A_pos = A_start
B_pos = B_start

flag = True
for i in range(A_pos, A_goal):
    if S[i] == '#':
        if S[i+1] == '#':
            flag = False

for i in range(B_pos, B_goal):
    if S[i] == '#':
        if S[i+1] == '#':
            flag = False
            
if flag == False:
    print ("No")
    sys.exit()
  


if A_goal < B_goal:
    print ("Yes")
    sys.exit()


if B_goal < A_goal :
    for i in range(B_pos , B_goal+1):
        if (S[i-1] == '.' or i-1 == A_pos) and (S[i]== '.') and (S[i+1] == '.'):
            print ("Yes")
            sys.exit()

            
print ("No")

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sun Jun  2 21:00:38 2019

@author: hisaki
"""

#at coder 2019年6月2日日曜日　A問題
import sys
N, A, B, C, D = map(int, input().split())
S = input()
A_start = A -1
B_start = B -1
A_goal = C -1
B_goal = D -1

A_pos = A_start
B_pos = B_start

def func(A_pos, B_pos):
    global N
    global A_goal
    global B_goal
    
    if A_pos == A_goal and B_pos == B_goal:
        print ("Yes")
        sys.exit()
    
    if A_pos <= N-2 and S[ A_pos + 1 ] != '#' and A_pos + 1 != B_pos:#操作A
        func(A_pos+1,B_pos)
    if A_pos <= N-3 and S[ A_pos + 2 ] != '#' and A_pos + 2 != B_pos:#操作A
        func(A_pos+2,B_pos)
    if B_pos <= N-2 and S[ B_pos + 1 ] != '#' and B_pos + 1 != A_pos:#操作A
        func(A_pos,B_pos+1)
    if B_pos <= N-3 and S[ B_pos + 2 ] != '#' and B_pos + 2 != A_pos:#操作A
        func(A_pos,B_pos+2)
    
    return

func(A_pos,B_pos)
print ("No")


    
                   





            




Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sun Jun  2 22:01:55 2019

@author: hisaki
"""

import sys
N, A, B, C, D = map(int, input().split())
S = input()
A_start = A -1
B_start = B -1
A_goal = C -1
B_goal = D -1

A_pos = A_start
B_pos = B_start

flag = True
for i in range(A_pos, A_goal):
    if S[i] == '#':
        if S[i+1] == '#':
            flag = False

for i in range(B_pos, B_goal):
    if S[i] == '#':
        if S[i+1] == '#':
            flag = False
            
if flag == False:
    print ("No")
    sys.exit()
  


if A_goal < B_goal:
    print ("Yes")
    sys.exit()


if B_goal < A_goal :
    for i in range(B_pos , B_goal+1):
        if (S[i-1] == '.' or i-1 == A_pos) and (S[i]== '.') and (S[i+1] == '.'):
            print ("Yes")
            sys.exit()

            
print ("No")

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sun Jun  2 21:00:38 2019

@author: hisaki
"""

#at coder 2019年6月2日日曜日　A問題
import sys
N, A, B, C, D = map(int, input().split())
S = input()
A_start = A -1
B_start = B -1
A_goal = C -1
B_goal = D -1

A_pos = A_start
B_pos = B_start

for i in range(N):
    if S[i] == '#' and i != N-1:
        if S[i+1] == '#':
            print ("No")
            sys.exit()

def func(A_pos, B_pos):
    global N
    global A_goal
    global B_goal
    
    if A_pos == A_goal and B_pos == B_goal:
        print ("Yes")
        sys.exit()
    
    if A_pos <= N-2 and S[ A_pos + 1 ] != '#' and A_pos + 1 != B_pos:#操作A
        func(A_pos+1,B_pos)
    if A_pos <= N-3 and S[ A_pos + 2 ] != '#' and A_pos + 2 != B_pos:#操作A
        func(A_pos+2,B_pos)
    if B_pos <= N-2 and S[ B_pos + 1 ] != '#' and B_pos + 1 != A_pos:#操作A
        func(A_pos,B_pos+1)
    if B_pos <= N-3 and S[ B_pos + 2 ] != '#' and B_pos + 2 != A_pos:#操作A
        func(A_pos,B_pos+2)
    
    return

func(A_pos,B_pos)
print ("No")


    
                   





            




Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sun Jun  2 22:01:55 2019

@author: hisaki
"""

import sys
N, A, B, C, D = map(int, input().split())
S = input()
A_start = A -1
B_start = B -1
A_goal = C -1
B_goal = D -1

A_pos = A_start
B_pos = B_start

flag = True
for i in range(A_pos, A_goal):
    if S[i] == '#':
        if S[i+1] == '#':
            flag = False

for i in range(B_pos, B_goal):
    if S[i] == '#':
        if S[i+1] == '#':
            flag = False
            
if flag == False:
    print ("No")
    sys.exit()
  


if A_goal < B_goal:
    print ("Yes")
    sys.exit()


if B_goal < A_goal :
    for i in range(B_pos , B_goal+1):
        if (S[i-1] == '.' or i-1 == A_pos) and (S[i]== '.') and (S[i+1] == '.'):
            print ("Yes")
            sys.exit()

            
print ("No")

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sun Jun  2 21:00:38 2019

@author: hisaki
"""

#at coder 2019年6月2日日曜日　A問題
import sys
N, A, B, C, D = map(int, input().split())
S = input()
A_start = A -1
B_start = B -1
A_goal = C -1
B_goal = D -1

A_pos = A_start
B_pos = B_start

for i in range(N):
    if S[i] == '#' and i != N-1:
        if S[i+1] == '#':
            print ("No")
            sys.exit()

def func(A_pos, B_pos):
    global N
    global A_goal
    global B_goal
    
    if A_pos == A_goal and B_pos == B_goal:
        print ("Yes")
        sys.exit()
    
    if A_pos != N-1 and S[ A_pos + 1 ] != '#' and A_pos + 1 != B_pos:#操作A
        func(A_pos+1,B_pos)
    if A_pos != N-1 and A_pos != N-2 and S[ A_pos + 2 ] != '#' and A_pos + 2 != B_pos:#操作A
        func(A_pos+2,B_pos)
    if B_pos != N-1 and S[ B_pos + 1 ] != '#' and B_pos + 1 != A_pos:#操作A
        func(A_pos,B_pos+1)
    if B_pos != N-1 and B_pos != N-2 and S[ B_pos + 2 ] != '#' and B_pos + 2 != A_pos:#操作A
        func(A_pos,B_pos+2)
    
    return

func(A_pos,B_pos)
print ("No")


    
                   





            




Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sun Jun  2 22:01:55 2019

@author: hisaki
"""

import sys
N, A, B, C, D = map(int, input().split())
S = input()
A_start = A -1
B_start = B -1
A_goal = C -1
B_goal = D -1

A_pos = A_start
B_pos = B_start

flag = True
for i in range(A_pos, A_goal):
    if S[i] == '#':
        if S[i+1] == '#':
            flag = False

for i in range(B_pos, B_goal):
    if S[i] == '#':
        if S[i+1] == '#':
            flag = False
            
if flag == False:
    print ("No")
    sys.exit()
  


if A_goal < B_goal:
    print ("Yes")
    sys.exit()


if B_goal < A_goal :
    for i in range(B_pos , B_goal+1):
        if (S[i-1] == '.' or i-1 == A_pos) and (S[i]== '.') and (S[i+1] == '.'):
            print ("Yes")
            sys.exit()

            
print ("No")