#include using namespace std; const int dx[]{-1, 0, 1, 0}; const int dy[]{0, -1, 0, 1}; int n, m; int a, sx, sy, b, gx, gy; string c[50]; bool vis[50][50][2510]; int main(){ cin >> n >> m >> a >> sx >> sy >> b >> gx >> gy; for (int i = 0; i < n; i++) cin >> c[i]; queue> q; vis[sx][sy][a] = true; q.emplace(sx, sy, a); while (q.size()){ int x, y, s; tie(x, y, s) = q.front(); q.pop(); for (int i = 0; i < 4; i++){ int nx = x + dx[i]; int ny = y + dy[i]; if (nx < 0 || n <= nx || ny < 0 || m <= ny) continue; int ns = s + (c[nx][ny] == '*' ? 1 : -1); if (ns <= 0 || ns > 2510) continue; if (vis[nx][ny][ns]) continue; vis[nx][ny][ns] = true; q.emplace(nx, ny, ns); } } cout << (vis[gx][gy][b] ? "Yes\n" : "No\n"); }