#include <bits/stdc++.h>
using namespace std;
const int N = 505, M = 600005;
int n, m, qq, ans[M];
char mp[N][N];
struct Query {
  int x1, y1, x2, y2, id;
} q[M], t[M];
bitset<N> f[N][N], g[N][N];
void solve(int l, int r, int x, int y) {
  if (l > r || x > y) return;
  int tl = x - 1, tr = y + 1, mid = (l + r) >> 1;
  for (int i = 1; i <= m; i++) f[mid][i].reset(), g[mid][i].reset();
  for (int i = m; i > 0; --i)
    if (mp[mid][i] == '.') f[mid][i][i] = 1, f[mid][i] |= f[mid][i + 1];
  for (int i = 1; i <= m; ++i)
    if (mp[mid][i] == '.') g[mid][i][i] = 1, g[mid][i] |= g[mid][i - 1];
  for (int i = mid - 1; i >= l; --i)
    for (int j = m; j > 0; --j)
      if (mp[i][j] == '.')
        f[i][j] = f[i + 1][j] | f[i][j + 1];
      else
        f[i][j].reset();
  for (int i = mid + 1; i <= r; i++)
    for (int j = 1; j <= m; j++)
      if (mp[i][j] == '.')
        g[i][j] = g[i - 1][j] | g[i][j - 1];
      else
        g[i][j].reset();
  for (int i = x; i <= y; i++)
    if (q[i].x2 < mid)
      t[++tl] = q[i];
    else if (q[i].x1 > mid)
      t[--tr] = q[i];
    else
      ans[q[i].id] = (f[q[i].x1][q[i].y1] & g[q[i].x2][q[i].y2]).any();
  for (int i = x; i <= tl; i++) q[i] = t[i];
  for (int i = tr; i <= y; i++) q[i] = t[i];
  solve(l, mid - 1, x, tl);
  solve(mid + 1, r, tr, y);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> (mp[i] + 1);
  cin >> qq;
  for (int i = 1; i <= qq; i++)
    cin >> q[i].x1 >> q[i].y1 >> q[i].x2 >> q[i].y2, q[i].id = i;
  solve(1, n, 1, qq);
  for (int i = 1; i <= qq; i++) cout << (ans[i] ? "Yes" : "No") << '\n';
  return 0;
}
