#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void read(T& x) {
  int f = 1;
  x = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  x *= f;
}
const int N = 500 + 5;
const int M = 600000 + 5;
int n, m, Q;
char s[N][N];
int ans[M];
bitset<N> f[N][N], g[N][N];
struct node {
  int x1, y1, x2, y2, id;
} q[M], A[M];
void printF(int x, int y) {
  printf("F[%d][%d] = ", x, y);
  for (int i = 1; i <= m; i++) printf("%d", f[x][y].test(i));
  printf("\n");
}
void printG(int x, int y) {
  printf("G[%d][%d] = ", x, y);
  for (int i = 1; i <= m; i++) printf("%d", g[x][y].test(i));
  printf("\n");
}
void solve(int l, int r, int ls, int rs) {
  if (ls > rs) return;
  int mid = (l + r) >> 1;
  for (int i = m; i >= 1; i--) {
    f[mid][i].reset();
    if (s[mid][i] != '#') {
      f[mid][i].set(i);
      f[mid][i] |= f[mid][i + 1];
    }
  }
  for (int i = 1; i <= m; i++) {
    g[mid][i].reset();
    if (s[mid][i] != '#') {
      g[mid][i].set(i);
      g[mid][i] |= g[mid][i - 1];
    }
  }
  for (int i = mid - 1; i >= l; i--)
    for (int j = m; j >= 1; j--) {
      f[i][j].reset();
      if (s[i][j] == '#') continue;
      f[i][j] = f[i][j + 1] | f[i + 1][j];
    }
  for (int i = mid + 1; i <= r; i++)
    for (int j = 1; j <= m; j++) {
      g[i][j].reset();
      if (s[i][j] == '#') continue;
      g[i][j] = g[i][j - 1] | g[i - 1][j];
    }
  int ql = ls - 1, qr = rs + 1;
  for (int i = ls; i <= rs; i++) {
    if (q[i].x2 < mid) {
      A[++ql] = q[i];
      continue;
    }
    if (q[i].x1 > mid) {
      A[--qr] = q[i];
      continue;
    }
    ans[q[i].id] = (f[q[i].x1][q[i].y1] & g[q[i].x2][q[i].y2]).any() ? 1 : 0;
  }
  for (int i = ls; i <= ql; i++) q[i] = A[i];
  for (int i = qr; i <= rs; i++) q[i] = A[i];
  solve(l, mid - 1, ls, ql);
  solve(mid + 1, r, qr, rs);
}
int main() {
  read(n), read(m);
  for (int i = 1; i <= n; i++) scanf("%s", s[i] + 1);
  read(Q);
  for (int i = 1; i <= Q; i++) {
    read(q[i].x1), read(q[i].y1);
    read(q[i].x2), read(q[i].y2);
    q[i].id = i;
  }
  solve(1, n, 1, Q);
  for (int i = 1; i <= Q; i++) puts(ans[i] ? "Yes" : "No");
  return 0;
}
