#include <bits/stdc++.h>
using namespace std;
int n, m, q, x[1005], y[1005], top, cnt, b[1000005];
int id[1005][1005], Mg[1000005], st[1005], fa[1000005], F[1000005], In[1000005];
int ID(int x, int y) {
  if (x < 0 || y < 0 || x > n + 1 || y > m + 1) return 0;
  if (x == 0 && y == 0 || x == n && y == m) return 0;
  if (x == n + 1 || y == 0) return 1;
  if (x == 0 || y == m + 1) return 2;
  return id[x][y];
}
long long qu[16006515], r;
void ins(int x, int y) {
  if (x > y) swap(x, y);
  qu[++r] = (long long)x * (cnt + 1) + y;
}
int Abs(int x) { return (x > 0 ? x : -x); }
bool ok(int x, int y) {
  if (x > y) swap(x, y);
  long long tmp = (long long)x * (cnt + 1) + y, L = 1, R = r, mid;
  while (L <= R) {
    mid = L + R >> 1;
    if (qu[mid] == tmp) return 1;
    if (qu[mid] > tmp)
      R = mid - 1;
    else
      L = mid + 1;
  }
  return 0;
}
int Get(int x) { return fa[x] == x ? x : fa[x] = Get(fa[x]); }
int G(int x) { return fa[x] == x ? x : G(fa[x]); }
void solve() {
  int s = G(1), t = G(2);
  if (s == t) {
    puts("NO");
    return;
  }
  for (int i = 1; i <= top; i++) Mg[i] = G(st[i]);
  for (int i = 1; i <= top; i++)
    if (Mg[i] == s)
      for (int j = 1; j <= top; j++) {
        if (Mg[j] == t && ok(F[st[i]], F[st[j]])) {
          puts("NO");
          return;
        }
      }
  puts("YES");
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  cnt = 2;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      char ch = getchar();
      while (ch != '.' && ch != '#') ch = getchar();
      id[i][j] = ++cnt;
      b[cnt] = ch == '.' ? 0 : 1;
    }
  b[1] = b[2] = 1;
  for (int i = 1; i <= cnt; i++) fa[i] = i;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      if (b[ID(i, j)]) {
        for (int i1 = i - 1; i1 <= i + 1; i1++)
          for (int j1 = j - 1; j1 <= j + 1; j1++)
            if (b[ID(i1, j1)]) fa[Get(ID(i, j))] = Get(ID(i1, j1));
      }
  for (int i = 1; i <= cnt; i++) F[i] = Get(i);
  for (int i = 0; i <= n + 1; i++)
    for (int j = 0; j <= m + 1; j++)
      for (int i1 = i - 2; i1 <= i + 2; i1++)
        for (int j1 = j - 2; j1 <= j + 2; j1++) {
          if (ID(i, j) + ID(i1, j1) == 3) continue;
          if (ID(i, j) && ID(i1, j1) && max(Abs(i1 - i), Abs(j1 - j)) == 2 &&
              Get(ID(i, j)) != Get(ID(i1, j1))) {
            ins(Get(ID(i, j)), Get(ID(i1, j1)));
          }
        }
  sort(qu + 1, qu + r + 1);
  while (q--) {
    int p;
    scanf("%d", &p);
    top = 2;
    st[1] = 1;
    st[2] = 2;
    In[1] = In[2] = 1;
    for (int i = 1; i <= p; i++) {
      int u, v;
      scanf("%d%d", &x[i], &y[i]);
      b[ID(x[i], y[i])] = 1;
      st[++top] = u = ID(x[i], y[i]);
      In[u] = 1;
      for (int i1 = x[i] - 1; i1 <= x[i] + 1; i1++)
        for (int j1 = y[i] - 1; j1 <= y[i] + 1; j1++) {
          if ((v = ID(i1, j1)) && b[v] == 1) {
            v = G(v);
            if (!In[v]) st[++top] = v, In[v] = 1;
            fa[G(u)] = v;
          }
        }
    }
    solve();
    fflush(stdout);
    for (int i = 1; i <= p; i++) b[ID(x[i], y[i])] = 0;
    for (int i = 1; i <= top; i++) {
      In[st[i]] = 0;
      fa[st[i]] = F[st[i]];
    }
  }
}
