#include <bits/stdc++.h>
using namespace std;
struct UF {
  vector<int> v;
  vector<pair<int, int>> und;
  vector<pair<int, set<int>>> und2;
  vector<set<int>> essense;
  UF(int n) : v(n, -1), essense(n) {}
  int find(int x) {
    if (v[x] < 0) return x;
    if (v[v[x]] < 0) return v[x];
    int r = find(v[x]);
    und.emplace_back(x, v[x]);
    v[x] = r;
    return r;
  }
  void join(int a, int b) {
    a = find(a), b = find(b);
    if (a == b) return;
    if (-v[a] < -v[b]) swap(a, b);
    und2.emplace_back(a, essense[a]);
    und.emplace_back(a, v[a]);
    und.emplace_back(b, v[b]);
    essense[a].insert(essense[b].begin(), essense[b].end());
    v[a] = v[a] + v[b];
    v[b] = a;
  }
  void undo() {
    while (!und.empty()) {
      auto pa = und.back();
      v[pa.first] = pa.second;
      und.pop_back();
    }
    while (!und2.empty()) {
      auto pa = und2.back();
      essense[pa.first] = move(pa.second);
      und2.pop_back();
    }
  }
};
int main() {
  cin.sync_with_stdio(false);
  cin.tie(0);
  cin.exceptions(cin.failbit);
  int H, W, Q;
  cin >> H >> W >> Q;
  vector<string> board(H + 2);
  for (int i = 0; i < (H); ++i)
    cin >> board[i + 1], board[i + 1] = '#' + board[i + 1] + '#';
  board[0] = board.back() = string(W + 2, '#');
  UF uf((H + 2) * (W + 2));
  auto code = [&](int i, int j) { return i * (W + 2) + j; };
  int bottomleft = code(H + 1, 0);
  int topright = code(0, W + 1);
  auto good = [&](int i, int j) {
    if (i < 0 || j < 0 || i >= H + 2 || j >= W + 2) return false;
    if (i <= 1 && j <= 1) return false;
    if (i >= H && j >= W) return false;
    return true;
  };
  auto goodmove = [&](int i, int j, int i2, int j2) {
    if (((i - i2) & 2) && ((j - j2) & 2) && !good((i + i2) >> 1, (j + j2) >> 1))
      return false;
    return true;
  };
  for (int i = 0; i < (H + 2); ++i)
    for (int j = 0; j < (W + 2); ++j)
      if (good(i, j) && board[i][j] == '#') {
        for (int di = -1; di < (2); ++di)
          for (int dj = -1; dj < (2); ++dj)
            if (di || dj) {
              int ni = i + di, nj = j + dj;
              if (good(ni, nj) && board[ni][nj] == '#') {
                uf.join(code(i, j), code(ni, nj));
              }
            }
      }
  uf.und.clear();
  uf.und2.clear();
  set<pair<int, int>> ed;
  for (int i = 0; i < (H + 2); ++i)
    for (int j = 0; j < (W + 2); ++j)
      if (good(i, j) && board[i][j] == '#') {
        for (int di = -2; di < (3); ++di)
          for (int dj = -2; dj < (3); ++dj)
            if (di || dj) {
              int ni = i + di, nj = j + dj;
              if (good(ni, nj) && goodmove(i, j, ni, nj) &&
                  board[ni][nj] == '#') {
                ed.insert(
                    pair<int, int>(uf.find(code(i, j)), uf.find(code(ni, nj))));
              }
            }
      }
  for (int i = 0; i < (H + 2); ++i)
    for (int j = 0; j < (W + 2); ++j)
      if (good(i, j) && board[i][j] == '#') {
        int c = code(i, j);
        if (uf.find(c) == c) uf.essense[c].insert(c);
      }
  auto query = [&](const vector<pair<int, int>>& ca) -> bool {
    bool ret = false;
    {
      for (auto& pa : ca) {
        int i, j;
        tie(i, j) = pa;
        board[i][j] = '#';
      }
      for (auto& pa : ca) {
        int i, j;
        tie(i, j) = pa;
        for (int di = -1; di < (2); ++di)
          for (int dj = -1; dj < (2); ++dj)
            if (di || dj) {
              int ni = i + di, nj = j + dj;
              if (good(ni, nj) && board[ni][nj] == '#') {
                uf.join(code(i, j), code(ni, nj));
              }
            }
      }
      int A = uf.find(bottomleft);
      int B = uf.find(topright);
      if (A == B) goto fail;
      for (auto& x : uf.essense[A])
        for (auto& y : uf.essense[B]) {
          if (ed.count(pair<int, int>(x, y))) goto fail;
        }
      for (auto& pa : ca) {
        int i, j;
        tie(i, j) = pa;
        int p = uf.find(code(i, j));
        for (int di = -2; di < (3); ++di)
          for (int dj = -2; dj < (3); ++dj)
            if (di || dj) {
              int ni = i + di, nj = j + dj;
              if (good(ni, nj) && goodmove(i, j, ni, nj) &&
                  board[ni][nj] == '#') {
                int q = uf.find(code(ni, nj));
                if (p == A && q == B) goto fail;
                if (p == B && q == A) goto fail;
              }
            }
      }
      ret = true;
    }
  fail:
    for (auto& pa : ca) {
      int i, j;
      tie(i, j) = pa;
      board[i][j] = '.';
    }
    uf.undo();
    return ret;
  };
  for (int qi = 0; qi < (Q); ++qi) {
    int K;
    cin >> K;
    vector<pair<int, int>> ca;
    for (int i = 0; i < (K); ++i) {
      int r, c;
      cin >> r >> c;
      ca.emplace_back(r, c);
    }
    cout << (query(ca) ? "YES" : "NO") << endl;
  }
  exit(0);
}
