#include <bits/stdc++.h>
using namespace std;
const int N = 1005, dx[] = {1, 0, -1, 0, 1, 1, -1, -1},
          dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
int f[N * N], ch[N][N], id[N][N];
char s[N];
set<pair<int, int>> st;
int getf(int v) { return f[v] == v ? v : f[v] = getf(f[v]); }
int getf2(int v) { return f[v] == v ? v : getf(f[v]); }
inline pair<int, int> calc(int x, int y) { return {min(x, y), max(x, y)}; }
inline void merge(int x, int y) { f[getf2(x)] = getf2(y); }
int kk, top, ans, bx[N], by[N], stk[N], n, m, q, ss, tt, idx, fl;
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m >> q;
  for (int i = 1; i <= n; i++) {
    cin >> (s + 1);
    for (int j = 1; j <= m; j++) ch[i][j] = (s[j] == '#');
  }
  ss = ++idx;
  tt = ++idx;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) id[i][j] = ++idx;
  for (int i = 1; i <= n; i++) {
    ch[i][0] = ch[i][m + 1] = 1;
    id[i][0] = ss;
    id[i][m + 1] = tt;
  }
  for (int i = 1; i <= m; i++) {
    ch[0][i] = ch[n + 1][i] = 1;
    id[0][i] = tt;
    id[n + 1][i] = ss;
  }
  for (int i = 1; i <= idx; i++) f[i] = i;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      if (ch[i][j])
        for (int k = 0; k < 8; k++) {
          int nx = i + dx[k], ny = j + dy[k];
          if (ch[nx][ny]) f[getf(id[i][j])] = getf(id[nx][ny]);
        }
  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 l = k + 1; l < 8; l++) {
          int nx = i + dx[k], ny = j + dy[k], nxx = i + dx[l], nyy = j + dy[l];
          st.insert(calc(getf(id[nx][ny]), getf(id[nxx][nyy])));
          if (calc(getf(id[nx][ny]), getf(id[nxx][nyy])) ==
              calc(getf(ss), getf(tt)))
            fl = 1, i = n + 1, j = m + 1;
        }
    }
  if (fl) {
    for (int i = 1; i <= q; i++) cout << "No" << endl;
    return 0;
  }
  while (q--) {
    cin >> kk;
    top = 0;
    for (int i = 1; i <= kk; i++) {
      cin >> bx[i] >> by[i];
      ch[bx[i]][by[i]] = 1;
      stk[++top] = getf(id[bx[i]][by[i]]);
      for (int j = 0; j < 8; j++) {
        int nx = bx[i] + dx[j], ny = by[i] + dy[j];
        if (ch[nx][ny]) stk[++top] = getf(id[nx][ny]);
      }
    }
    stk[++top] = getf(ss);
    stk[++top] = getf(tt);
    sort(stk + 1, stk + top + 1);
    top = unique(stk + 1, stk + top + 1) - stk - 1;
    for (int i = 1; i <= kk; i++)
      for (int j = 0; j < 8; j++) {
        int nx = bx[i] + dx[j], ny = by[i] + dy[j];
        if (ch[nx][ny]) merge(id[nx][ny], id[bx[i]][by[i]]);
      }
    ans = 1;
    for (int i = 1; i <= top; i++)
      if (getf2(stk[i]) == getf2(ss))
        for (int j = 1; j <= top; j++)
          if (getf2(stk[j]) == getf2(tt) && st.count(calc(stk[i], stk[j])))
            ans = 0;
    cout << (ans ? "YES" : "NO") << endl;
    fflush(stdout);
    for (int i = 1; i <= kk; i++) ch[bx[i]][by[i]] = 0;
    while (top) f[stk[top]] = stk[top], --top;
  }
  return 0;
}
