#include <bits/stdc++.h>
using namespace std;
bitset<505> f[505][505], g[505][505];
int n, m, ans[600005];
struct asd {
  int x, y, xx, yy, id;
} q[600005], q1[600005], q2[600005];
char s[555][555];
void solve(int l, int r, int qx, int qy) {
  if (l > r || qx > qy) return;
  int mid = l + r >> 1;
  for (int j = m; j >= 1; j--) {
    f[mid][j].reset();
    if (s[mid][j] == '.') f[mid][j][j] = 1;
    if (j + 1 <= m && s[mid][j + 1] == '.') f[mid][j] |= f[mid][j + 1];
  }
  for (int j = 1; j <= m; j++) {
    g[mid][j].reset();
    if (s[mid][j] == '.') g[mid][j][j] = 1;
    if (j - 1 >= 1 && s[mid][j - 1] == '.') g[mid][j] |= g[mid][j - 1];
  }
  for (int i = mid - 1; i >= l; i--) {
    for (int j = m; j >= 1; j--) {
      if (s[i][j] == '#') continue;
      f[i][j].reset();
      if (j + 1 <= m && s[i][j + 1] == '.') f[i][j] |= f[i][j + 1];
      if (i + 1 <= mid && s[i + 1][j] == '.') f[i][j] |= f[i + 1][j];
    }
  }
  for (int i = mid + 1; i <= r; i++) {
    for (int j = 1; j <= m; j++) {
      if (s[i][j] == '#') continue;
      g[i][j].reset();
      if (i - 1 >= mid && s[i - 1][j] == '.') g[i][j] |= g[i - 1][j];
      if (j - 1 >= 1 && s[i][j - 1] == '.') g[i][j] |= g[i][j - 1];
    }
  }
  int t1 = 0, t2 = 0;
  for (int i = qx; i <= qy; i++) {
    if (q[i].xx < mid) q1[++t1] = q[i];
    if (q[i].x > mid) q2[++t2] = q[i];
    if (q[i].x <= mid && q[i].xx >= mid)
      ans[q[i].id] = (f[q[i].x][q[i].y] & g[q[i].xx][q[i].yy]).any();
  }
  for (int i = 1; i <= t1; i++) q[qx + i - 1] = q1[i];
  for (int i = 1; i <= t2; i++) q[qx + t1 + i - 1] = q2[i];
  solve(l, mid, qx, qx + t1 - 1);
  solve(mid + 1, r, qx + t1, qx + t1 + t2 - 1);
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    scanf("%s", s[i] + 1);
  }
  int Q;
  cin >> Q;
  for (int i = 1; i <= Q; i++) {
    scanf("%d%d%d%d", &q[i].x, &q[i].y, &q[i].xx, &q[i].yy);
    q[i].id = i;
  }
  solve(1, n, 1, Q);
  for (int i = 1; i <= Q; i++) {
    if (ans[i])
      printf("Yes\n");
    else
      printf("No\n");
  }
  return 0;
}
