#include <bits/stdc++.h>
using namespace std;
const int maxn = 510;
const int maxQ = 6e5 + 10;
int n, m, Q;
bool ans[maxQ];
char a[maxn][maxn];
bitset<maxn> f[maxn][maxn], g[maxn][maxn];
struct Query {
  int x1, my1, x2, y2, id;
} q[maxQ], tmpl[maxQ], tmpr[maxQ];
inline int read() {
  char c = getchar();
  int res = 0, f = 1;
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') res = res * 10 + c - '0', c = getchar();
  return res * f;
}
void solve(int l, int r, int ql, int qr) {
  if (l > r || ql > qr) return;
  int mid = (l + r) >> 1, cntl = 0, cntr = 0;
  for (int i = mid; i >= l; i--)
    for (int j = m; j; j--) {
      f[i][j].reset();
      if (a[i][j] == '#') continue;
      if (i == mid) f[i][j][j] = (a[i][j] == '.');
      if (i + 1 <= mid && a[i + 1][j] == '.') f[i][j] |= f[i + 1][j];
      if (j + 1 <= m && a[i][j + 1] == '.') f[i][j] |= f[i][j + 1];
    }
  for (int i = mid; i <= r; i++)
    for (int j = 1; j <= m; j++) {
      g[i][j].reset();
      if (a[i][j] == '#') continue;
      if (i == mid) g[i][j][j] = (a[i][j] == '.');
      if (i - 1 >= mid && a[i - 1][j] == '.') g[i][j] |= g[i - 1][j];
      if (j - 1 >= 1 && a[i][j - 1] == '.') g[i][j] |= g[i][j - 1];
    }
  for (int i = ql; i <= qr; i++) {
    if (q[i].x2 < mid)
      tmpl[++cntl] = q[i];
    else if (q[i].x1 > mid)
      tmpr[++cntr] = q[i];
    else
      ans[q[i].id] = (f[q[i].x1][q[i].my1] & g[q[i].x2][q[i].y2]).any();
  }
  for (int i = 1; i <= cntl; i++) q[ql + i - 1] = tmpl[i];
  for (int i = 1; i <= cntr; i++) q[qr - i + 1] = tmpr[i];
  solve(l, mid - 1, ql, ql + cntl - 1);
  solve(mid + 1, r, qr - cntr + 1, qr);
}
int main() {
  n = read(), m = read();
  for (int i = 1; i <= n; i++) scanf("%s", a[i] + 1);
  Q = read();
  for (int i = 1; i <= Q; i++)
    q[i].x1 = read(), q[i].my1 = read(), q[i].x2 = read(), q[i].y2 = read(),
    q[i].id = i;
  solve(1, n, 1, Q);
  for (int i = 1; i <= Q; i++) puts(ans[i] ? "Yes" : "No");
  return 0;
}
