#include <bits/stdc++.h>
#pragma GCC optimize("no-stack-protector")
using namespace std;
const int MAXBUF = 1000005;
char B[MAXBUF], *Si = B, *Ti = B;
inline char getc() {
  if (Si == Ti) Ti = (Si = B) + fread(B, 1, MAXBUF, stdin);
  if (Si == Ti) return 0;
  return *Si++;
}
template <class T>
inline void read(T &a) {
  static char c;
  while (((c = getc()) < '0' || c > '9'))
    ;
  a = c - '0';
  while ((c = getc()) >= '0' && c <= '9') a = (a << 3) + (a << 1) + c - '0';
}
struct query {
  int xl, xr, yl, yr, id;
} t[600005], p[600005];
bitset<505> f1[505][505], f2[505][505], res;
bool g[505][505], ans[600005];
char s[505];
int n, m, q;
void solve(int l, int r, int lo, int ro) {
  if (l > r || lo > ro) return;
  int mid = (l + r) >> 1, i, j, p1 = lo - 1, p2 = ro + 1;
  for (i = 1; i <= m; i++) f1[mid][i] = f2[mid][i] = 0;
  for (i = m; i >= 1; i--) {
    if (g[mid][i]) {
      f1[mid][i][i] = 1;
      f1[mid][i] |= f1[mid][i + 1];
    }
  }
  for (i = 1; i <= m; i++) {
    if (g[mid][i]) {
      f2[mid][i][i] = 1;
      f2[mid][i] |= f2[mid][i - 1];
    }
  }
  for (i = mid - 1; i >= l; i--) {
    for (j = m; j >= 1; j--) {
      if (!g[i][j]) {
        f1[i][j] = 0;
        continue;
      }
      f1[i][j] = f1[i + 1][j] | f1[i][j + 1];
    }
  }
  for (i = mid + 1; i <= r; i++) {
    for (j = 1; j <= m; j++) {
      if (!g[i][j]) {
        f2[i][j] = 0;
        continue;
      }
      f2[i][j] = f2[i - 1][j] | f2[i][j - 1];
    }
  }
  for (i = lo; i <= ro; i++) {
    if (t[i].xr < mid) {
      p[++p1] = t[i];
      continue;
    }
    if (t[i].xl > mid) {
      p[--p2] = t[i];
      continue;
    }
    res = f1[t[i].xl][t[i].yl] & f2[t[i].xr][t[i].yr];
    if (res.any()) {
      ans[t[i].id] = 1;
    } else {
      ans[t[i].id] = 0;
    }
  }
  for (i = lo; i <= ro; i++) t[i] = p[i];
  solve(l, mid - 1, lo, p1);
  solve(mid + 1, r, p2, ro);
}
int main() {
  int i, j;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++) {
    scanf("%s", s + 1);
    for (j = 1; j <= m; j++) {
      if (s[j] == '.')
        g[i][j] = 1;
      else
        g[i][j] = 0;
    }
  }
  read(q);
  for (i = 1; i <= q; i++) {
    read(t[i].xl);
    read(t[i].yl);
    read(t[i].xr);
    read(t[i].yr);
    t[i].id = i;
  }
  solve(1, n, 1, q);
  for (i = 1; i <= q; i++) puts(ans[i] ? "Yes" : "No");
  return 0;
}
