#include <bits/stdc++.h>
using namespace std;
template <typename T>
void qread(T &x) {
  x = 0;
  T sign = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') sign = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  x = x * sign;
}
int n, m, q;
char a[1000 + 5][1000 + 5];
int id[1000 + 5][1000 + 5];
int s, t;
int fa[1000 * 1000 + 5];
void ini(int n) {
  for (int i = 1; i <= n; i++) fa[i] = i;
}
int find(int x) {
  if (fa[x] == x)
    return x;
  else
    return fa[x] = find(fa[x]);
}
int sfind(int x) {
  if (fa[x] == x)
    return x;
  else
    return sfind(fa[x]);
}
void merge(int x, int y) { fa[find(x)] = find(y); }
int stk[1000 + 5], top;
void smerge(int x, int y) {
  int fx = sfind(x), fy = sfind(y);
  if (fx != fy) {
    stk[++top] = fx;
    stk[++top] = fy;
    fa[fx] = fa[fy];
  }
}
void retract() {
  while (top) {
    fa[stk[top]] = stk[top];
    top--;
  }
}
const int dirx[8] = {1, 1, 1, -1, -1, -1, 0, 0};
const int diry[8] = {1, -1, 0, 1, -1, 0, 1, -1};
set<pair<int, int> > S;
inline pair<int, int> mp(int x, int y) {
  return make_pair(min(x, y), max(x, y));
}
int cnt;
int qx[1000 + 5], qy[1000 + 5];
bool check() {
  stk[++top] = sfind(t);
  stk[++top] = sfind(s);
  for (int i = 1; i <= top; i++) {
    if (sfind(s) == sfind(stk[i])) {
      for (int j = 1; j <= top; j++) {
        if (sfind(t) == sfind(stk[j])) {
          if (S.find(mp(stk[i], stk[j])) != S.end()) return 0;
        }
      }
    }
  }
  return 1;
}
int main() {
  qread(n);
  qread(m);
  qread(q);
  for (int i = 1; i <= n; i++) scanf("%s", a[i] + 1);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) id[i][j] = (i - 1) * m + j;
  }
  s = n * m + 1, t = n * m + 2;
  ini(t);
  for (int i = 1; i <= n; i++) {
    id[i][0] = s;
    id[i][m + 1] = t;
    a[i][0] = a[i][m + 1] = '#';
  }
  for (int i = 1; i <= m; i++) {
    id[0][i] = t;
    id[n + 1][i] = s;
    a[0][i] = a[n + 1][i] = '#';
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (a[i][j] != '#') continue;
      for (int k = 0; k < 8; k++)
        if (a[i + dirx[k]][j + diry[k]] == '#')
          merge(id[i][j], id[i + dirx[k]][j + diry[k]]);
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if ((i == 1 && j == 1) || (i == n && j == m)) continue;
      for (int k = 0; k < 8; k++) {
        for (int u = k + 1; u < 8; u++) {
          S.insert(mp(find(id[i + dirx[k]][j + diry[k]]),
                      find(id[i + dirx[u]][j + diry[u]])));
        }
      }
    }
  }
  while (q--) {
    qread(cnt);
    for (int j = 1; j <= cnt; j++) {
      qread(qx[j]);
      qread(qy[j]);
    }
    for (int i = 1; i <= cnt; i++) a[qx[i]][qy[i]] = '#';
    for (int i = 1; i <= cnt; i++) {
      for (int k = 0; k < 8; k++) {
        if (a[qx[i] + dirx[k]][qy[i] + diry[k]] == '#') {
          smerge(id[qx[i]][qy[i]], id[qx[i] + dirx[k]][qy[i] + diry[k]]);
        }
      }
    }
    if (check())
      puts("YES");
    else
      puts("NO");
    fflush(stdout);
    retract();
    for (int i = 1; i <= cnt; i++) a[qx[i]][qy[i]] = '.';
  }
}
