#include <bits/stdc++.h>
inline int getint() {
  register int num = 0, sgn = 1;
  register char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') sgn = 0;
  for (; isdigit(ch); ch = getchar()) num = (num << 3) + (num << 1) + ch - '0';
  return sgn ? num : -num;
}
inline int getblock() {
  register char ch = getchar();
  while (ch != '.' && ch != '#') ch = getchar();
  return ch == '.';
}
int n, m;
bool map[502][502];
std::bitset<502> f[502][502][9], g[502][502][9];
void solve(int l, int r, int k) {
  if (l > r) return;
  int mid = (l + r) >> 1;
  solve(l, mid - 1, k + 1);
  solve(mid + 1, r, k + 1);
  for (register int i = n; i; i--) {
    if (map[i][mid]) {
      f[i][mid][k][i] = 1;
      f[i][mid][k] |= f[i + 1][mid][k];
    }
    for (register int j = mid - 1; j >= l; j--)
      if (map[i][j]) f[i][j][k] |= f[i + 1][j][k] | f[i][j + 1][k];
  }
  for (register int i = 1; i <= n; i++) {
    if (map[i][mid]) {
      g[i][mid][k][i] = 1;
      g[i][mid][k] |= g[i - 1][mid][k];
    }
    for (register int j = mid + 1; j <= r; j++)
      if (map[i][j]) g[i][j][k] |= g[i - 1][j][k] | g[i][j - 1][k];
  }
}
int calc(int l, int r, int k, int y1, int y2) {
  int mid = (l + r) >> 1;
  if (y2 < mid) return calc(l, mid - 1, k + 1, y1, y2);
  if (y1 > mid) return calc(mid + 1, r, k + 1, y1, y2);
  return k;
}
inline bool check(int x1, int y1, int x2, int y2) {
  if (x1 > x2 || y1 > y2) return 0;
  int k = calc(1, m, 0, y1, y2);
  return (f[x1][y1][k] & g[x2][y2][k]).count();
}
int main() {
  n = getint();
  m = getint();
  for (register int i = 1; i <= n; i++)
    for (register int j = 1; j <= m; j++) map[i][j] = getblock();
  solve(1, m, 0);
  for (register int q = getint(); q; q--) {
    int x1 = getint(), y1 = getint(), x2 = getint(), y2 = getint();
    puts(check(x1, y1, x2, y2) ? "Yes" : "No");
  }
  return 0;
}
