#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int sum = 0;
  char c = getchar();
  bool f = 0;
  while (c < '0' || c > '9') {
    if (c == '-') f = 1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    sum = sum * 10 + c - '0';
    c = getchar();
  }
  if (f) return -sum;
  return sum;
}
inline char getc() {
  char c = getchar();
  while (c != '.' && c != '#') c = getchar();
  return c == '.';
}
const int N = 505;
const int M = 600005;
int n, m, T;
bool mp[N][N], ans[M];
struct ex {
  int x1, y1, x2, y2, id;
  inline void INIT(int __) {
    x1 = read();
    y1 = read();
    x2 = read();
    y2 = read();
    id = __;
  }
} q[M], a[M], b[M];
bitset<N> f[N][N], g[N][N];
inline void solve(int x1, int y1, int x2, int y2, int l, int r) {
  if (l > r) return;
  int i, j;
  for (i = x1 - 1; i <= x2 + 1; i++)
    for (j = y1 - 1; j <= y2 + 1; j++) f[i][j].reset(), g[i][j].reset();
  if (y2 - y1 >= x2 - x1) {
    int mid = (y1 + y2) >> 1;
    for (i = x2; i >= x1; i--)
      if (mp[i][mid]) f[i][mid] = f[i + 1][mid], f[i][mid][i] = 1;
    for (i = mid - 1; i >= y1; i--)
      for (j = x2; j >= x1; j--)
        if (mp[j][i]) f[j][i] = f[j + 1][i] | f[j][i + 1];
    for (i = x1; i <= x2; i++)
      if (mp[i][mid]) g[i][mid] = g[i - 1][mid], g[i][mid][i] = 1;
    for (i = mid + 1; i <= y2; i++)
      for (j = x1; j <= x2; j++)
        if (mp[j][i]) g[j][i] = g[j - 1][i] | g[j][i - 1];
    int l1 = 0, l2 = 0;
    for (i = l; i <= r; i++)
      if (q[i].y1 <= mid && q[i].y2 >= mid)
        ans[q[i].id] = (f[q[i].x1][q[i].y1] & g[q[i].x2][q[i].y2]).any();
      else if (q[i].y2 < mid)
        a[++l1] = q[i];
      else
        b[++l2] = q[i];
    for (i = 1; i <= l1; i++) q[l + i - 1] = a[i];
    for (i = 1; i <= l2; i++) q[r - i + 1] = b[i];
    solve(x1, y1, x2, mid, l, l + l1 - 1);
    solve(x1, mid + 1, x2, y2, r - l2 + 1, r);
  } else {
    int mid = (x1 + x2) >> 1;
    for (i = y2; i >= y1; i--)
      if (mp[mid][i]) f[mid][i] = f[mid][i + 1], f[mid][i][i] = 1;
    for (i = mid - 1; i >= x1; i--)
      for (j = y2; j >= y1; j--)
        if (mp[i][j]) f[i][j] = f[i + 1][j] | f[i][j + 1];
    for (i = y1; i <= y2; i++)
      if (mp[mid][i]) g[mid][i] = g[mid][i - 1], g[mid][i][i] = 1;
    for (i = mid + 1; i <= x2; i++)
      for (j = y1; j <= y2; j++)
        if (mp[i][j]) g[i][j] = g[i - 1][j] | g[i][j - 1];
    int l1 = 0, l2 = 0;
    for (i = l; i <= r; i++)
      if (q[i].x1 <= mid && q[i].x2 >= mid)
        ans[q[i].id] = (f[q[i].x1][q[i].y1] & g[q[i].x2][q[i].y2]).any();
      else if (q[i].x2 < mid)
        a[++l1] = q[i];
      else
        b[++l2] = q[i];
    for (i = 1; i <= l1; i++) q[l + i - 1] = a[i];
    for (i = 1; i <= l2; i++) q[r - i + 1] = b[i];
    solve(x1, y1, mid, y2, l, l + l1 - 1);
    solve(mid + 1, y1, x2, y2, r - l2 + 1, r);
  }
}
int main() {
  int i, j;
  n = read();
  m = read();
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) mp[i][j] = getc();
  T = read();
  for (i = 1; i <= T; i++) q[i].INIT(i);
  solve(1, 1, n, m, 1, T);
  for (i = 1; i <= T; i++) puts(ans[i] ? "Yes" : "No");
  return 0;
}
