#include <bits/stdc++.h>
using namespace std;
const int Max = 1e3, Max_Q = 1e4;
const int fx[8] = {0, 0, 1, 1, 1, -1, -1, -1};
const int fy[8] = {1, -1, 0, 1, -1, 0, 1, -1};
int h, w, Q, cnt, s, t, Top, siz, q[Max + 5], stk[Max + 5],
    Id[Max + 5][Max + 5], fa[Max * Max + 5], vis[Max * Max + 5];
char S[Max + 5][Max + 5];
map<int, int> Tag[Max * Max + 5];
struct kk {
  int x, y;
} A[20];
inline int Get(int x) { return x == fa[x] ? x : fa[x] = Get(fa[x]); }
inline int GET(int x) { return x == fa[x] ? x : GET(fa[x]); }
int main() {
  scanf("%d%d%d", &h, &w, &Q);
  for (int i = 1; i <= h; i++) scanf("%s", S[i] + 1);
  for (int i = 1; i <= h; i++)
    for (int j = 1; j <= w; j++) Id[i][j] = ++cnt;
  s = ++cnt, t = ++cnt;
  for (int i = 1; i <= w; i++) Id[0][i] = s, Id[h + 1][i] = t;
  for (int i = 1; i <= h; i++) Id[i][0] = t, Id[i][w + 1] = s;
  vis[s] = vis[t] = 1;
  for (int i = 1; i <= h; i++)
    for (int j = 1; j <= w; j++) vis[Id[i][j]] = S[i][j] == '#';
  for (int i = 1; i <= cnt; i++) fa[i] = i;
  for (int i = 1; i <= h; i++)
    for (int j = 1; j <= w; j++)
      if (vis[Id[i][j]])
        for (int k = 0; k < 8; k++)
          if (vis[Id[i + fx[k]][j + fy[k]]])
            fa[Get(Id[i][j])] = Get(Id[i + fx[k]][j + fy[k]]);
  int flg = 0;
  for (int i = 1; i <= h; i++)
    for (int j = 1; j <= w; j++)
      if ((i != 1 || j != 1) && (i != h || j != w))
        for (int x = 0; x < 8; x++)
          if (vis[Id[i + fx[x]][j + fy[x]]])
            for (int y = x + 1; y < 8; y++)
              if (vis[Id[i + fx[y]][j + fy[y]]]) {
                int Fx = Get(Id[i + fx[x]][j + fy[x]]);
                int Fy = Get(Id[i + fx[y]][j + fy[y]]);
                int Fs = Get(s), Ft = Get(t);
                if (min(Fx, Fy) == min(Fs, Ft) && max(Fx, Fy) == max(Fs, Ft))
                  flg = 1;
                Tag[Fx][Fy] = Tag[Fy][Fx] = 1;
              }
  if (flg == 1) {
    for (int i = 1; i <= Q; i++) puts("NO");
    return 0;
  }
  for (int i = 1; i <= cnt; i++) fa[i] = Get(i);
  for (int T = 1; T <= Q; T++) {
    int K;
    scanf("%d", &K);
    Top = siz = flg = 0;
    q[++siz] = Get(s), q[++siz] = Get(t);
    for (int i = 1; i <= K; i++) {
      scanf("%d%d", &A[i].x, &A[i].y);
      vis[Id[A[i].x][A[i].y]] = 1;
      q[++siz] = Get(Id[A[i].x][A[i].y]);
      for (int j = 0; j < 8; j++)
        if (vis[Id[A[i].x + fx[j]][A[i].y + fy[j]]])
          q[++siz] = Get(Id[A[i].x + fx[j]][A[i].y + fy[j]]);
    }
    for (int i = 1; i <= K; i++)
      for (int j = 0; j < 8; j++)
        if (vis[Id[A[i].x + fx[j]][A[i].y + fy[j]]])
          stk[++Top] = GET(Id[A[i].x + fx[j]][A[i].y + fy[j]]),
          fa[stk[Top]] = GET(Id[A[i].x][A[i].y]);
    for (int i = 1; i <= K; i++) {
      for (int j = 0; j < 8; j++)
        if (!vis[Id[A[i].x + fx[j]][A[i].y + fy[j]]]) {
          int nx = A[i].x + fx[j], ny = A[i].y + fy[j];
          if ((nx == 1 && ny == 1) || (nx == h && ny == w)) continue;
          for (int x = 0; x < 8; x++)
            if (vis[Id[nx + fx[x]][ny + fy[x]]])
              for (int y = x + 1; y < 8; y++)
                if (vis[Id[nx + fx[y]][ny + fy[y]]]) {
                  int Fx = GET(Id[nx + fx[x]][ny + fy[x]]),
                      Fy = GET(Id[nx + fx[y]][ny + fy[y]]);
                  int Fs = GET(s), Ft = GET(t);
                  if (min(Fx, Fy) == min(Fs, Ft) && max(Fx, Fy) == max(Fs, Ft))
                    flg = 1;
                }
        }
    }
    sort(q + 1, q + siz + 1);
    siz = unique(q + 1, q + siz + 1) - q - 1;
    for (int i = 1; i <= siz; i++)
      if (GET(q[i]) == GET(s))
        for (int j = 1; j <= siz; j++)
          if (GET(q[j]) == GET(t) && Tag[q[i]][q[j]]) flg = 1;
    flg ? puts("NO") : puts("YES");
    fflush(stdout);
    for (int i = 1; i <= Top; i++) fa[stk[i]] = stk[i];
    for (int i = 1; i <= K; i++) vis[Id[A[i].x][A[i].y]] = 0;
  }
  return 0;
}
