#include <bits/stdc++.h>
using namespace std;
const int maxn = (int)6e5 + 100;
int n, m, q;
char second[555][555];
bitset<555> can1[555][555], can2[555][555];
bitset<maxn> ans;
void solve(int l, int r,
           vector<pair<pair<int, int>, pair<pair<int, int>, int> > > Q) {
  if (l > r) return;
  int mid = (l + r) >> 1;
  vector<pair<pair<int, int>, pair<pair<int, int>, int> > > L, R, now;
  for (auto x : Q) {
    if (x.first.second < mid && x.second.first.second < mid)
      L.push_back(x);
    else if (x.first.second > mid && x.second.first.second > mid)
      R.push_back(x);
    else
      now.push_back(x);
  }
  for (int j = (mid); j <= (r); ++j) {
    for (int i = (1); i <= (n); ++i) {
      can1[i][j] = 0;
      if (second[i][j] == '.') {
        if (j == mid) can1[i][j][i] = 1;
        if (i > 1) can1[i][j] |= can1[i - 1][j];
        if (j > mid) can1[i][j] |= can1[i][j - 1];
      }
    }
  }
  for (int j = (mid); j >= (l); --j) {
    for (int i = (n); i >= (1); --i) {
      can2[i][j] = 0;
      if (second[i][j] == '.') {
        if (j == mid) can2[i][j][i] = 1;
        if (i < n) can2[i][j] |= can2[i + 1][j];
        if (j < mid) can2[i][j] |= can2[i][j + 1];
      }
    }
  }
  for (auto x : now) {
    ans[x.second.second] = ((can2[x.first.first][x.first.second] &
                             can1[x.second.first.first][x.second.first.second])
                                        .count() > 0
                                ? 1
                                : 0);
  }
  solve(l, mid - 1, L);
  solve(mid + 1, r, R);
}
vector<pair<pair<int, int>, pair<pair<int, int>, int> > > Q;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = (1); i <= (n); ++i) scanf("%s", second[i] + 1);
  scanf("%d", &q);
  for (int i = (1); i <= (q); ++i) {
    int x1, y1, x2, y2;
    scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
    Q.push_back(make_pair(make_pair(x1, y1), make_pair(make_pair(x2, y2), i)));
  }
  solve(1, m, Q);
  for (int i = (1); i <= (q); ++i) puts(ans[i] ? "Yes" : "No");
}
