#include <bits/stdc++.h>
using namespace std;
inline int read(void) {
  int x = 0, f = 1;
  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();
  }
  return f * x;
}
const int maxn = 505, maxq = 6e5 + 5;
int n, m, Q;
bool ans[maxq];
char ch[maxn][maxn];
struct Query {
  int x1, y1, x2, y2;
} q[maxq];
bitset<maxn> f[maxn][maxn], g[maxn][maxn];
void solve(int l, int r) {
  if (l > r) return;
  int mid = (l + r) >> 1;
  for (int j = m; j >= 1; --j) {
    f[mid][j].reset();
    if (ch[mid][j] == '.') {
      f[mid][j][j] = 1;
      f[mid][j] |= f[mid][j + 1];
    }
  }
  for (int i = mid - 1; i >= l; --i) {
    for (int j = m; j >= 1; --j) {
      f[i][j].reset();
      if (ch[i][j] == '.') f[i][j] = f[i + 1][j] | f[i][j + 1];
    }
  }
  for (int j = 1; j <= m; ++j) {
    g[mid][j].reset();
    if (ch[mid][j] == '.') {
      g[mid][j][j] = 1;
      g[mid][j] |= g[mid][j - 1];
    }
  }
  for (int i = mid + 1; i <= r; ++i) {
    for (int j = 1; j <= m; ++j) {
      g[i][j].reset();
      if (ch[i][j] == '.') g[i][j] = g[i - 1][j] | g[i][j - 1];
    }
  }
  for (int i = 1; i <= Q; ++i) {
    int x1 = q[i].x1, x2 = q[i].x2, y1 = q[i].y1, y2 = q[i].y2;
    if (l <= x1 && x1 <= mid && mid <= x2 && x2 <= r)
      if ((f[x1][y1] & g[x2][y2]).any()) ans[i] = 1;
  }
  solve(l, mid - 1);
  solve(mid + 1, r);
}
int main() {
  n = read();
  m = read();
  for (int i = 1; i <= n; ++i) scanf("%s", ch[i] + 1);
  Q = read();
  for (int i = 1; i <= Q; ++i) {
    q[i].x1 = read();
    q[i].y1 = read();
    q[i].x2 = read();
    q[i].y2 = read();
  }
  solve(1, n);
  for (int i = 1; i <= Q; ++i) puts(ans[i] ? "Yes" : "No");
  return 0;
}
