#include <bits/stdc++.h>
using namespace std;
const int N = 502;
const int AKBARONELOVE = 2e6;
const int INF = 1e9 + 9;
const int B = 1e9 + 7;
int n, m, qs;
char a[N][N];
bitset<N> back[N][N], forth[N][N];
struct query {
  short r1, c1, r2, c2;
  int id;
  query() {}
  query(short _r1, short _c1, short _r2, short _c2, int _id)
      : r1(_r1), c1(_c1), r2(_r2), c2(_c2), id(_id) {}
};
bool ans[AKBARONELOVE];
query Q[AKBARONELOVE];
void solve(int l, int r, int ql, int qr) {
  if (ql > qr) return;
  int mid = (l + r) >> 1;
  for (int i = int(m); i >= int(1); --i) {
    if (a[mid][i] == '#') continue;
    back[mid][i] = back[mid][i + 1];
    back[mid][i][i - 1] = 1;
  }
  for (int i = int(mid - 1); i >= int(l); --i)
    for (int j = int(m); j >= int(1); --j)
      if (a[i][j] == '.') back[i][j] = (back[i + 1][j] | back[i][j + 1]);
  for (int i = int(1); i <= int(m); ++i) {
    if (a[mid][i] == '#') continue;
    forth[mid][i] = forth[mid][i - 1];
    forth[mid][i][i - 1] = 1;
  }
  for (int i = int(mid + 1); i <= int(r); ++i)
    for (int j = int(1); j <= int(m); ++j)
      if (a[i][j] == '.') forth[i][j] = (forth[i - 1][j] | forth[i][j - 1]);
  for (int i = int(ql); i <= int(qr); ++i) {
    query &q = Q[i];
    int r1 = q.r1, c1 = q.c1, r2 = q.r2, c2 = q.c2;
    if (r1 <= mid && mid <= r2)
      ans[q.id] = ((back[r1][c1] & forth[r2][c2]).count() > 0);
  }
  int ptrl = ql - 1, ptrr = qr + 1;
  for (int i = int(ql); i <= int(qr); ++i)
    if (Q[i].r2 < mid) swap(Q[++ptrl], Q[i]);
  for (int i = int(qr); i >= int(ql); --i)
    if (mid < Q[i].r1) swap(Q[--ptrr], Q[i]);
  if (l < mid) solve(l, mid - 1, ql, ptrl);
  if (mid < r) solve(mid + 1, r, ptrr, qr);
}
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  int cnt = 0;
  for (int i = int(1); i <= int(n); ++i) {
    for (int j = int(1); j <= int(m); ++j) {
      cin >> a[i][j];
      cnt += (a[i][j] == '#');
    }
  }
  cin >> qs;
  for (int i = int(1); i <= int(qs); ++i) {
    if (cnt == 0) cout << "Yes\n";
    cin >> Q[i].r1 >> Q[i].c1 >> Q[i].r2 >> Q[i].c2;
    Q[i].id = i;
  }
  if (cnt == 0) return 0;
  solve(1, n, 1, qs);
  for (int i = int(1); i <= int(qs); ++i)
    cout << (ans[i] ? "Yes" : "No") << "\n";
  return 0;
}
