// Arup Guha
// Started a long time ago.
// Finished on 4/12/2019 with lots of help from Travis Meade!!! (Thank you Travis!)
// Note: This gets a TLE on the USACO servers but on my laptop Veris says the slowest case was
//       2.63 seconds. I am guessing my Java flags might be different than USACO's.

import java.util.*;
import java.io.*;

public class pushabox {

	final public static int[] DX = {0,1,0,-1};
	final public static int[] DY = {1,0,-1,0};
	final public static int MASK = (1<<11) - 1;

	public static int r;
	public static int c;
	public static char[][] grid;
	public static boolean[][] res;
	public static int[] bcc;
	
	public static void main(String[] args) throws Exception {

		// Read the grid.
		BufferedReader stdin = new BufferedReader(new FileReader("pushabox.in"));
		StringTokenizer tok = new StringTokenizer(stdin.readLine());
		r = Integer.parseInt(tok.nextToken());
		c = Integer.parseInt(tok.nextToken());
		int numQ = Integer.parseInt(tok.nextToken());

		grid = new char[r][];
		for (int i=0; i<r; i++)
			grid[i] = stdin.readLine().trim().toCharArray();
		
		MagicComponents mc = new MagicComponents(r*c);
		int id = 0;
		for (int i=0; i<r; i++) {
			for (int j=0; j<c; j++) {
				if (grid[i][j] == '#') continue;
				for (int k=0; k<2; k++) {
					int nx = i + DX[k];
					int ny = j + DY[k];
					if (!inbounds(nx,ny) || grid[nx][ny] == '#') continue;
					mc.addEdge(i*c+j, nx*c+ny);
				}
			}
		}
		
		// Run BCC and then store which edges are in the same one.
		mc.run();
		bcc = new int[2*r*c];
		Arrays.fill(bcc, -1);
		
		// Fill in component names.
		int numC = mc.bccs.size();
		for (int i=0; i<numC; i++) {
			for (Edge x: mc.bccs.get(i))
				bcc[getCode(x.u,x.v)] = i;
		}
		
		// Find Bessie and the box.
		res = new boolean[r][c];
		for (int i=0; i<r; i++) Arrays.fill(res[i], false);
		int box = find('B');
		res[box/c][box%c] = true;
		int me = find('A');

		// This is our starting state for the BFS.
		int init = makeInitState(me, box);
		boolean[] used = new boolean[1<<25];
		used[init] = true;
		LinkedList<Integer> q = new LinkedList<Integer>();
		q.offer(init);

		// Run BFS here.
		while (q.size() > 0) {

			// Extract this state.
			int cur = q.poll();
			int cX = (cur >> 14);
			int cY = ((cur >> 3) & MASK);
			boolean atBox = (cur & (1<<2)) == 0 ? false : true;
			int dir = -1;
			if (atBox) dir = (cur & 3);

			// This is easier - not at the box, just move me.
			if (!atBox) {
				for (int i=0; i<4; i++) {
					int nX = cX + DX[i];
					int nY = cY + DY[i];
					if (!inbounds(nX,nY)) continue;
					if (grid[nX][nY] == '#') continue;
					int nState = makeInitState(nX*c+nY, box);
					if (used[nState]) continue;
					q.offer(nState);
					used[nState] = true;
				}
			}

			// We are at box.
			else {

				// We know where the box is.
				int bX = cX + DX[dir];
				int bY = cY + DY[dir];
				res[bX][bY] = true;

				// Try going same dir, pushing the box.
				if (inbounds(bX+DX[dir], bY+DY[dir]) && grid[bX+DX[dir]][bY+DY[dir]] != '#') {
					res[bX+DX[dir]][bY+DY[dir]] = true;
					int nState = (bX << 14) + (bY << 3) + (1<<2) + dir;
					if (!used[nState]) {
						q.offer(nState);
						used[nState] = true;
					}
				}

				// Try moving to a different size of the box.
				for (int k=0; k<4; k++) {

					// New place to move to.
					int mX = bX + DX[k];
					int mY = bY + DY[k];
					
					// Been there, out of bounds, or it's an illegal square.
					if (mX == cX && mY == cY) continue;
					if (!inbounds(mX,mY)) continue;
					if (grid[mX][mY] == '#') continue;
					
					// Helpful to have variables for these things.
					int mKey = mX*c + mY;
					int cKey = cX*c + cY;
					int bKey = bX*c + bY;
					int id1 = getCode(mKey, bKey);
					int id2 = getCode(cKey, bKey);
					int newd = getDir(mX, mY, bX, bY);
					
					// These two edges are in the same BCC, so we can travel between them another way.
					if (bcc[id1] == bcc[id2] && bcc[id1] != -1) {
						int nState = (mX << 14) + (mY << 3) + (1<<2) + newd;
						if (used[nState]) continue;
						q.offer(nState);
						used[nState] = true;
					}
				}
			}
		}

		// Process queries.
		StringBuffer sb = new StringBuffer();
		for (int i=0; i<numQ; i++) {
			tok = new StringTokenizer(stdin.readLine());
			int x = Integer.parseInt(tok.nextToken())-1;
			int y = Integer.parseInt(tok.nextToken())-1;
			if (res[x][y]) 	sb.append("YES\n");
			else			sb.append("NO\n");
		}
		PrintWriter out = new PrintWriter(new FileWriter("pushabox.out"));
		out.print(sb);
		out.close();
		stdin.close();
	}

	// Returns the direction from (x,y) to (tx,ty) as stored in my DX/DY arrays.
	public static int getDir(int x, int y, int tx, int ty) {
		for (int i=0; i<4; i++)
			if (tx-x == DX[i] && ty-y == DY[i])
				return i;
		return -1;
	}

	public static boolean inbounds(int x, int y) {
		return x >= 0 && x < r && y >= 0 && y < c;
	}

	// Returns the state for my BFS given where I am (bessie) and the box.
	public static int makeInitState(int me,int box) {
		int mx = me/c;
		int my = me%c;
		int bx = box/c;
		int by = box%c;
		int diff = Math.abs(mx-bx) + Math.abs(my-by);

		// Box isn't next to bessie, so last three bits are 0.
		if (diff > 1) return (mx << 14) +(my << 3);

		// Find which direction Bessie is from the box. (1<<2) means bessie is next to the box, 2 LSB
		// are which direction to move to go from bessie to the box.
		return (mx<<14) + (my<<3) + (1<<2) + getDir(mx, my, bx, by);
	}

	// Returns the location of ch in the grid. If it's in (x,y) returns x*c+y.
	public static int find(char ch) {
		for (int i=0; i<r; i++)
			for (int j=0; j<c; j++)
				if (grid[i][j] == ch)
					return i*c + j;
		return -1;
	}
	
	// Here is my "code" for storing edges.
	public static int getCode(int v, int w) {
		int low = Math.min(v, w);
		int high = Math.max(v, w);
		int add = (high-low == 1) ? 0 : 1;
		return (low << 1) + add;
	}
}

/* UCF Team Hackpack Code Below for BCC */
// Bi-connected Components
// Two-Connected Components
// Articulation or cut points
// Bridges //$
class Edge {
	int u, v, id;
	public Edge(int U, int V, int i) {
		u = U; v = V; id = i;
	}
}

class MagicComponents { // Stack Trick!

	int num, n, edges;
	int[] dfsNum, low, vis;
	ArrayList<Integer> cuts;
	ArrayList<Edge> bridges, adj[];
	ArrayList<ArrayList<Edge>> bccs; 
	ArrayDeque<Edge> eStack;
  
	MagicComponents(int N) {
		adj = new ArrayList[n = N];
		for (int i = 0; i < n; i++)
			adj[i] = new ArrayList<>();
		edges = 0;
	}
  
  void addEdge(int u, int v) {
    adj[u].add(new Edge(u, v, edges));
    adj[v].add(new Edge(v, u, edges++));
  }
  
  void run() {
    vis = new int[n];
    dfsNum = new int[n];
    low = new int[n];
    bridges = new ArrayList<>();
    cuts = new ArrayList<>();
    bccs = new ArrayList<>();
    eStack = new ArrayDeque<>();
    num = 0;
    
    for (int i = 0; i < n; i++) {
      if (vis[i] != 0) continue;
      dfs(i, -1);
    }
  }
  
  void dfs(int node, int par) {
    dfsNum[node] = low[node] = num++;
    vis[node] = 1;
    int nChild = 0;
    for(Edge e : adj[node]) {
      if(e.v == par) continue;
      if(vis[e.v] == 0) {
        ++nChild; eStack.push(e); dfs(e.v, node);
        low[node] = Math.min(low[node], low[e.v]);
        if(low[e.v] >= dfsNum[node]) {
          if(dfsNum[node] > 0 || nChild > 1)
            cuts.add(node);
          if(low[e.v] > dfsNum[node]) {
            bridges.add(e); pop(node);
          } else pop(node);
        }
      } else if(vis[e.v] == 1) {
        low[node] = Math.min(low[node], dfsNum[e.v]);
        eStack.push(e);
      } 
    }
    vis[node] = 2;
	
	
  }

  void pop(int u) {
    ArrayList<Edge> list = new ArrayList<>();
    for (;;) {
      Edge e = eStack.pop(); list.add(e);
      if(e.u == u) break;
    }
    bccs.add(list);
  }
}
