func_code_string: #include <bits/stdc++.h>   using namespace std;   int Q, n, m, ans[600005], a[505][505];   char S[505];   struct O {     int p, q, x, y, i;   } o[600005], O[600005];   bitset<505> f[505][505], g[505][505];   void go(int l, int r, int p, int q) {     if (p > q) return;     int mi = l + r >> 1, L, R, t;     for (int i = 1; i <= n; ++i)       if (!a[i][mi])         g[i][mi].reset();       else         g[i][mi] = g[i - 1][mi], g[i][mi].set(i);     for (int j = mi + 1; j <= r; ++j)       for (int i = 1; i <= n; ++i) {         g[i][j].reset();         if (!a[i][j]) continue;         if (a[i][j - 1]) g[i][j] |= g[i][j - 1];         if (a[i - 1][j]) g[i][j] |= g[i - 1][j];       }     for (int i = n; i; --i)       if (!a[i][mi])         f[i][mi].reset();       else         f[i][mi] = f[i + 1][mi], f[i][mi].set(i);     for (int j = mi - 1; j >= l; --j)       for (int i = n; i; --i) {         f[i][j].reset();         if (!a[i][j]) continue;         if (a[i][j + 1]) f[i][j] |= f[i][j + 1];         if (a[i + 1][j]) f[i][j] |= f[i + 1][j];       }     L = p;     R = q;     for (int i = p; i <= q; ++i)       if (o[i].q < mi && o[i].y < mi)         O[L++] = o[i];       else if (o[i].q > mi && o[i].y > mi)         O[R--] = o[i];     t = L;     for (int i = p; i <= q; ++i)       if (o[i].q <= mi && o[i].y >= mi) O[t++] = o[i];     for (int i = p; i <= q; ++i) o[i] = O[i];     for (int i = L; i <= R; ++i)       if (o[i].p <= o[i].x && o[i].q <= o[i].y)         ans[o[i].i] = (f[o[i].p][o[i].q] & g[o[i].x][o[i].y]).any();     if (l == r) return;     go(l, mi - 1, p, L - 1);     go(mi + 1, r, R + 1, q);   }   int main() {     scanf( %d%d , &n, &m);     for (int i = 1; i <= n; ++i) {       scanf( %s , S + 1);       for (int j = 1; j <= m; ++j) a[i][j] = S[j] ==  . ;     }     scanf( %d , &Q);     for (int i = 1; i <= Q; ++i)       scanf( %d%d%d%d , &o[i].p, &o[i].q, &o[i].x, &o[i].y), o[i].i = i;     go(1, m, 1, Q);     for (int i = 1; i <= Q; ++i) puts(ans[i] ?  Yes  :  No );     return 0;   }   