#include<bits/stdc++.h>
using namespace std;
const int N = 110;
int n,m,n1,m1,n2,m2;
char mp[N][N];
bool vis[N][N];
bool flag = false;
int dx[] = {0,0,-1,1};
int dy[] = {1,-1,0,0};
struct node{
int x;
int y;
};
bool check(int x,int y){
if(x>0 && x<=n && y>0 && y<=m && mp[x][y] == '.' && !vis[x][y]){
return true;
}
return false;
}
void bfs(int x,int y){
stack<node>q;
q.push({x,y});
vis[x][y] = true;
while(!q.empty()){
node f = q.top();
q.pop();
if(f.x == n2 && f.y == m2){
flag = true;
return ;
}
for(int i = 0;i<4;i++){
int nx = dx[i]+f.x;
int ny = dy[i]+f.y;
if(check(nx,ny)){
q.push({nx,ny});
vis[nx][ny] = true;
}
}
}
return ;
}
int main(){
cin>>n>>m;
cin>>n1>>m1>>n2>>m2;
for(int i = 1;i<=n;i++){
for(int j = 1;j<=m;j++){
cin>>mp[i][j];
}
}
}