#include <bits/stdc++.h>
using namespace std;
const int N = 502;
const int M = 6e5 + 20;
bitset<N> f[N][N], u[N][N];
char s[N][N];
int n, m;
int ans[M];
struct node {
  int x, y, z, w, id;
  node() {}
  node(int a, int b, int c, int d, int e) {
    x = a;
    y = b;
    z = c;
    w = d;
    id = e;
  }
} g[M], t[M];
void solve(int l, int r, int l1, int r1) {
  if (l > r || l1 > r1) return;
  int mid = l + r >> 1;
  for (int i = l; i <= mid; i++)
    for (int j = 1; j <= m; j++) f[i][j].reset();
  for (int i = mid; i <= r; i++)
    for (int j = 1; j <= m; j++) u[i][j].reset();
  for (int i = 1; i <= m; i++)
    if (s[mid][i] != '#') f[mid][i].set(i);
  for (int i = mid; i >= l; i--)
    for (int j = m; j >= 1; j--)
      if (s[i][j] != '#') {
        if (s[i][j + 1] != '#' && j + 1 <= m) f[i][j] |= f[i][j + 1];
        if (s[i + 1][j] != '#' && i + 1 <= mid) f[i][j] |= f[i + 1][j];
      }
  for (int i = 1; i <= m; i++)
    if (s[mid][i] != '#') u[mid][i].set(i);
  for (int i = mid; i <= r; i++)
    for (int j = 1; j <= m; j++)
      if (s[i][j] != '#') {
        if (s[i][j - 1] != '#' && j > 1) u[i][j] |= u[i][j - 1];
        if (s[i - 1][j] != '#' && i > mid) u[i][j] |= u[i - 1][j];
      }
  int tl = l1, tr = r1;
  for (int i = l1; i <= r1; i++) {
    if (g[i].x <= mid && g[i].z >= mid) {
      ans[g[i].id] = (f[g[i].x][g[i].y] & u[g[i].z][g[i].w]).any();
    } else if (g[i].z < mid)
      t[tl++] = g[i];
    else
      t[tr--] = g[i];
  }
  for (int i = l1; i <= r1; i++) g[i] = t[i];
  solve(l, mid - 1, l1, tl - 1);
  solve(mid + 1, r, tr + 1, r1);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%s", s[i] + 1);
  int q;
  scanf("%d", &q);
  for (int i = 1; i <= q; i++) {
    int x, y, z, w;
    scanf("%d%d%d%d", &x, &y, &z, &w);
    g[i] = node(x, y, z, w, i);
  }
  solve(1, n, 1, q);
  for (int i = 1; i <= q; i++) ans[i] ? printf("Yes\n") : printf("No\n");
  return 0;
}
