#include <bits/stdc++.h>
using namespace std;
const int N = 505;
int n, m, qc;
bool fd[N][N];
bitset<N> bs1[N][N];
bitset<N> bs2[N][N];
struct query {
  int x1, y1, x2, y2;
  int id;
};
vector<query> qs;
vector<bool> ans;
void solve(vector<int>& ids, int tl, int tr) {
  if (ids.size() == 0) return;
  if (tl > tr) return;
  vector<int> l;
  vector<int> r;
  int tm = (tl + tr) / 2;
  for (int i = n - 1; i >= 0; i--) {
    bs1[i][tm].reset();
    if (!fd[i][tm]) {
      bs1[i][tm][i] = true;
      if (i + 1 < n) bs1[i][tm] |= bs1[i + 1][tm];
    }
  }
  for (int i = n - 1; i >= 0; i--) {
    for (int j = tm - 1; j >= tl; j--) {
      bs1[i][j].reset();
      if (fd[i][j]) continue;
      if (i + 1 < n) bs1[i][j] |= bs1[i + 1][j];
      bs1[i][j] |= bs1[i][j + 1];
    }
  }
  for (int i = 0; i < n; i++) {
    bs2[i][tm].reset();
    if (!fd[i][tm]) {
      bs2[i][tm][i] = true;
      if (i > 0) bs2[i][tm] |= bs2[i - 1][tm];
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = tm + 1; j <= tr; j++) {
      bs2[i][j].reset();
      if (fd[i][j]) continue;
      if (i - 1 >= 0) bs2[i][j] |= bs2[i - 1][j];
      bs2[i][j] |= bs2[i][j - 1];
    }
  }
  for (int id : ids) {
    query& q = qs[id];
    if (q.y1 < tm && q.y2 < tm) {
      l.push_back(id);
    } else if (q.y1 > tm && q.y2 > tm) {
      r.push_back(id);
    } else {
      bitset<N> bans = bs1[q.x1][q.y1] & bs2[q.x2][q.y2];
      ans[id] = bans.any();
    }
  }
  solve(l, tl, tm - 1);
  solve(r, tm + 1, tr);
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  ;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      char c;
      cin >> c;
      fd[i][j] = (c == '#');
    }
  }
  cin >> qc;
  qs.resize(qc);
  for (int i = 0; i < qc; i++) {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    x1--;
    y1--;
    x2--;
    y2--;
    qs[i] = {x1, y1, x2, y2, i};
  }
  vector<int> ids;
  ids.reserve(qc);
  for (int i = 0; i < qc; i++) {
    if (qs[i].x1 > qs[i].x2 || qs[i].y1 > qs[i].y2) continue;
    ids.push_back(i);
  }
  ans.resize(qc);
  solve(ids, 0, m - 1);
  for (bool t : ans) cout << (t ? "Yes" : "No") << "\n";
  return 0;
}
