#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
inline void read(int &s) {
  s = 0;
  static char c = getchar();
  while (c < '0' || c > '9') c = getchar();
  while (c >= '0' && c <= '9') {
    s = (s << 1) + (s << 3) + (c & 15);
    c = getchar();
  }
  return;
}
const int N = 503;
bitset<N> f1[N][N], f2[N][N], l;
int n, m, q;
char s[N][N];
bool ans[600007];
struct stu {
  int num;
  int a, b, c, d;
} p[600007], t[600007];
void work(int L, int R, int wl, int wr) {
  if (L > R || wl > wr) return;
  int tl = wl - 1, tr = wr + 1;
  int i, j, mid = L + R >> 1;
  for (i = 1; i <= m; ++i) f1[mid][i] = f2[mid][i] = 0;
  for (i = m; i; --i)
    if (s[mid][i] == '.') {
      f1[mid][i][i] = 1;
      f1[mid][i] |= f1[mid][i + 1];
    }
  for (i = 1; i <= m; ++i)
    if (s[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; --j)
      f1[i][j] = (s[i][j] == '.') ? (f1[i + 1][j] | f1[i][j + 1]) : 0;
  for (i = mid + 1; i <= R; ++i)
    for (j = 1; j <= m; ++j)
      f2[i][j] = (s[i][j] == '.') ? (f2[i - 1][j] | f2[i][j - 1]) : 0;
  for (i = wl; i <= wr; ++i) {
    if (p[i].c < mid) {
      t[++tl] = p[i];
      continue;
    }
    if (p[i].a > mid) {
      t[--tr] = p[i];
      continue;
    }
    l = f1[p[i].a][p[i].b] & f2[p[i].c][p[i].d];
    if (l.any())
      ans[p[i].num] = 1;
    else
      ans[p[i].num] = 0;
  }
  for (i = wl; i <= tl; ++i) p[i] = t[i];
  for (i = tr; i <= wr; ++i) p[i] = t[i];
  work(L, mid - 1, wl, tl);
  work(mid + 1, R, tr, wr);
  return;
}
int main() {
  read(n), read(m);
  int i, j;
  for (i = 1; i <= n; ++i) {
    for (j = 1; j <= m; ++j) {
      s[i][j] = getchar();
      while (s[i][j] != '.' && s[i][j] != '#') s[i][j] = getchar();
    }
  }
  read(q);
  for (i = 1; i <= q; ++i)
    read(p[i].a), read(p[i].b), read(p[i].c), read(p[i].d), p[i].num = i;
  work(1, n, 1, q);
  for (i = 1; i <= q; ++i) puts(ans[i] ? "Yes" : "No");
  return 0;
}
