#include <bits/stdc++.h>
using namespace std;
vector <string> grid;
bool visited[500+9][500+9];
int row,col;
int sx,sy;
int fx,fy;
bool condition(int i,int j){
if(i<0 || j<0 || i>=row || j>=col)
return false;
return true;
}
char c='.';
void DFS(int i,int j){
visited[i][j]=true;
if(grid[i][j-1]==c && condition(i,j-1))
DFS(i,j-1);
if(grid[i-1][j]==c && condition(i-1,j))
DFS(i-1,j);
if(grid[i+1][j]==c && condition(i+1,j))
DFS(i+1,j);
if(grid[i][j+1]==c && condition(i,j+1))
DFS(i,j+1);
}
int main(){ //freopen("in.txt","r",stdin);
cin>>row>>col;
string s;
for(int i=0;i<row;i++){
cin>>s;
grid.push_back(s);
}
cin>>sx>>sy;
cin>>fx>>fy;
DFS(sx-1,sy-1);
if(visited[fx-1][fy-1]) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwp2ZWN0b3IgPHN0cmluZz4gZ3JpZDsKYm9vbCB2aXNpdGVkWzUwMCs5XVs1MDArOV07CmludCByb3csY29sOwoKaW50IHN4LHN5OwppbnQgZngsZnk7CgoKYm9vbCBjb25kaXRpb24oaW50IGksaW50IGopewogICAgaWYoaTwwIHx8IGo8MCB8fCBpPj1yb3cgfHwgaj49Y29sKQogICAgICAgIHJldHVybiBmYWxzZTsKICAgIHJldHVybiB0cnVlOwp9CmNoYXIgYz0nLic7CnZvaWQgREZTKGludCBpLGludCBqKXsKICAgIHZpc2l0ZWRbaV1bal09dHJ1ZTsKCiAgICAgaWYoZ3JpZFtpXVtqLTFdPT1jICYmIGNvbmRpdGlvbihpLGotMSkpCiAgICAgICAgREZTKGksai0xKTsKICAgIGlmKGdyaWRbaS0xXVtqXT09YyAmJiBjb25kaXRpb24oaS0xLGopKQogICAgICAgIERGUyhpLTEsaik7CiAgICBpZihncmlkW2krMV1bal09PWMgJiYgY29uZGl0aW9uKGkrMSxqKSkKICAgICAgICB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