#include using namespace std; using i64 = int64_t; using vi = vector; using vvi = vector; vvi board; int main() { int h, w; cin >> h >> w; int a, si, sj, b, gi, gj; cin >> a >> si >> sj >> b >> gi >> gj; board = vvi(h, vi(w)); for (int i = 0; i < h; i++) { string s; cin >> s; for (int j = 0; j < w; j++) { board[i][j] = s[j] == '*'; } } vector dp(1200, vvi(h, vi(w, 1e9))); using ii = pair; using iii = pair; queue que; dp[a][si][sj] = 0; que.push(iii(ii(si, sj), a)); int dx[] = {-1, 1, 0, 0}; int dy[] = {0, 0, -1, 1}; auto ok = [&](int x, int y) { return 0 <= x && x < h && 0 <= y && y < w; }; while (que.size()) { iii t = que.front(); que.pop(); for (int i = 0; i < 4; i++) { int x = t.first.first + dx[i]; int y = t.first.second + dy[i]; if (ok(x, y)) { int sz = t.second + (board[x][y] ? 1 : -1); if (sz <= 0 || sz >= 1200) continue; if (dp[t.second][t.first.first][t.first.second] + 1 < dp[sz][x][y]) { dp[sz][x][y] = dp[t.second][t.first.first][t.first.second] + 1; que.push(iii(ii(x, y), sz)); } } } } cout << (dp[b][gi][gj] == 1e9 ? "No" : "Yes") << endl; }