#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void smin(T &a, U b) {
  if (a > b) a = b;
}
template <typename T, typename U>
inline void smax(T &a, U b) {
  if (a < b) a = b;
}
char s[510][510];
int n, m, ans[6000010];
struct query {
  int x1, y1, x2, y2, id;
  void input(int _id) {
    scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
    id = _id;
  }
} Q;
bitset<510> dp[2][510][510];
void solve(int L, int R, vector<query> v) {
  if (L > R) return;
  int mid = L + R >> 1;
  for (int i = mid; i >= L; i--) {
    for (int j = m; j; j--) {
      dp[0][i][j].reset();
      if (s[i][j] == '.') {
        dp[0][i][j] |= dp[0][i][j + 1];
        if (i == mid)
          dp[0][i][j].set(j);
        else
          dp[0][i][j] |= dp[0][i + 1][j];
      }
    }
  }
  for (int i = mid; i <= R; i++) {
    for (int j = 1; j <= m; j++) {
      dp[1][i][j].reset();
      if (s[i][j] == '.') {
        dp[1][i][j] |= dp[1][i][j - 1];
        if (i == mid)
          dp[1][i][j].set(j);
        else
          dp[1][i][j] |= dp[1][i - 1][j];
      }
    }
  }
  vector<query> v1, v2;
  for (int i = v.size(); i--;) {
    if (v[i].x1 <= mid && v[i].x2 >= mid) {
      ans[v[i].id] = (dp[0][v[i].x1][v[i].y1] & dp[1][v[i].x2][v[i].y2]).any();
    } else if (v[i].x2 < mid)
      v1.push_back(v[i]);
    else
      v2.push_back(v[i]);
  }
  solve(L, mid - 1, v1);
  solve(mid + 1, R, v2);
}
vector<query> v;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) scanf("%s", s[i] + 1);
  int q;
  cin >> q;
  for (int i = 0; i < q; i++) {
    Q.input(i);
    v.push_back(Q);
  }
  solve(1, n, v);
  for (int i = 0; i < q; i++) {
    puts(ans[i] ? "Yes" : "No");
  }
  return 0;
}
