Buggy python submission (verdict: Runtime Error):
n,a,b,c,d=map(int,input().split())
s=str(input())
arr=[]
for i in range(len(s)):
	if(s[i]=='#'):
		arr.append(-1)
	elif(s[i]=='.'):
		arr.append(0)

a-=1
b-=1
c-=1
d-=1
flag=0
arr[a]=1
arr[b]=2
arr[c]=3
arr[d]=4

if(c<d):
	while(pos2<d):
		if(pos2+1<n and arr[pos2+1]==0):
			pos2+=1
			arr[pos2-1]=0
			arr[pos2]=2
		else:
			if(pos2+2<n and arr[pos2+2]==0):
				pos2+=2
				arr[pos2-2]=0
				arr[pos2]=2
			else:
				flag=1
				break
	while(pos1<c):
		if(pos1+1<n and arr[pos1+1]==0):
			arr[pos1]=0
			arr[pos1+1]=1
			pos1+=1
		else:
			if(pos1+2<n and arr[pos1+2]==0):
				pos1+=2
				arr[pos1-2]=0
				arr[pos1]=1
			else:
				flag=1
				break
else:
	pos1=a
	pos2=b
	temp=0
	#print(flag)
	while(pos2>pos1):
		if(pos1+1<n and arr[pos1+1]==0):
			arr[pos1]=0
			arr[pos1+1]=1
			pos1+=1
		else:
			if(pos1+2<n and arr[pos1+2]==0):
				pos1+=2
				arr[pos1-2]=0
				arr[pos1]=1
			else:
				if(pos2<d):
					if(pos2+1<n and arr[pos2+1]==0):
						pos2+=1
						arr[pos2-1]=0
						arr[pos2]=2
					else:
						if(pos2+2<n and arr[pos2+2]==0):
							pos2+=2
							arr[pos2-2]=0
							arr[pos2]=2
						else:
							flag=1
							break
				else:
					flag=1
					break
		#print(flag)
		#print(arr)
	if(flag==0):
		while(pos1<c):
			if(pos1+1<n and arr[pos1+1]==0):
				arr[pos1]=0
				arr[pos1+1]=1
				pos1+=1
			else:
				if(pos1+2<n and arr[pos1+2]==0):
					pos1+=2
					arr[pos1-2]=0
					arr[pos1]=1
				else:
					flag=1
					break
		while(pos2<d):
			if(pos2+1<n and arr[pos2+1]==0):
				pos2+=1
				arr[pos2-1]=0
				arr[pos2]=2
			else:
				if(pos2+2<n and arr[pos2+2]==0):
					pos2+=2
					arr[pos2-2]=0
					arr[pos2]=2
				else:
					flag=1
					break

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

	


Fixed submission:
n,a,b,c,d=map(int,input().split())
s=str(input())
arr=[]
for i in range(len(s)):
	if(s[i]=='#'):
		arr.append(-1)
	elif(s[i]=='.'):
		arr.append(0)

a-=1
b-=1
c-=1
d-=1
flag=0
arr[a]=1
arr[b]=2
pos1=a
pos2=b
if(c<d):
	while(pos2<d):
		if(pos2+1<n and arr[pos2+1]==0):
			pos2+=1
			arr[pos2-1]=0
			arr[pos2]=2
		else:
			if(pos2+2<n and arr[pos2+2]==0):
				pos2+=2
				arr[pos2-2]=0
				arr[pos2]=2
			else:
				flag=1
				break
		#print(arr)
	while(pos1<c):
		if(pos1+1<n and arr[pos1+1]==0):
			arr[pos1]=0
			arr[pos1+1]=1
			pos1+=1
		else:
			if(pos1+2<n and arr[pos1+2]==0):
				pos1+=2
				arr[pos1-2]=0
				arr[pos1]=1
			else:
				flag=1
				break
else:
	
	#print(flag)
	while(pos2>pos1):
		if(pos1+1<n and arr[pos1+1]==0):
			arr[pos1]=0
			arr[pos1+1]=1
			pos1+=1
		else:
			if(pos1+2<n and arr[pos1+2]==0):
				pos1+=2
				arr[pos1-2]=0
				arr[pos1]=1
			else:
				if(pos2<d):
					if(pos2+1<n and arr[pos2+1]==0):
						pos2+=1
						arr[pos2-1]=0
						arr[pos2]=2
					else:
						if(pos2+2<n and arr[pos2+2]==0):
							pos2+=2
							arr[pos2-2]=0
							arr[pos2]=2
						else:
							flag=1
							break
				else:
					flag=1
					break
		#print(flag)
		#print(arr)
	if(flag==0):
		while(pos1<c):
			if(pos1+1<n and arr[pos1+1]==0):
				arr[pos1]=0
				arr[pos1+1]=1
				pos1+=1
			else:
				if(pos1+2<n and arr[pos1+2]==0):
					pos1+=2
					arr[pos1-2]=0
					arr[pos1]=1
				else:
					flag=1
					break
		while(pos2<d):
			if(pos2+1<n and arr[pos2+1]==0):
				pos2+=1
				arr[pos2-1]=0
				arr[pos2]=2
			else:
				if(pos2+2<n and arr[pos2+2]==0):
					pos2+=2
					arr[pos2-2]=0
					arr[pos2]=2
				else:
					flag=1
					break

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