#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> Tree;

#define sz(x) (int)(x).size()
#define ll long long
#define ld long double
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair <int, int>
#define vi vector<int>
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define vpi vector<pair<int, int>>

#define f0r(i,a) for(int i=0;i<a;i++)
#define f1r(i,a,b) for(int i=a;i<b;i++)

#define read1(a) int a; scanf("%d", &a)
#define read2(a,b) int a,b; scanf("%d %d", &a, &b)
#define read3(a,b,c) int a,b,c; scanf("%d %d %d", &a, &b, &c)
#define read(n,arr) int arr[n]; f0r(i,n){ scanf("%d", &arr[i]); }
#define print1(a) printf("%d \n", a)
#define print2(a, b) printf("%d %d \n", a, b)
#define print3(a, b, c) printf("%d %d %d \n", a, b, c)
#define print(v) for (int i : v) { printf("%d ", i); } printf("\n")

#define debug printf("asdf\n");
#define newl printf("\n");
#define usaco(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout);
void fast_io(){
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
void io(string taskname){
    string fin = taskname + ".in";
    string fout = taskname + ".out";
    const char* FIN = fin.c_str();
    const char* FOUT = fout.c_str();
    freopen(FIN, "r", stdin);
    freopen(FOUT, "w", stdout);
    fast_io();
}

const int MAX = 1505;
const int BIG = 2250005;

static int n, m, q;

int vis[BIG][4];
int grid[MAX][MAX];
int reach[BIG];
//checks if location to visit is valid and inbounds and not a hay pile
int valid(int x, int y){
    int a = x/m;
    int b = x%m;
    if(y == 0){ //up
        a-= 1;
    }
    else if(y == 2){ //down
        a+= 1;
    }
    else if(y == 1){ // left
        b-= 1;
    }
    else{ //right
        b+= 1;
    }
    if(a>=0  && a<n && b>=0 && b<m && grid[a][b] == 0){ //not filled with hay
         return a*m + b; //return
    }
    return -1;
}
//finds biconnected components
struct BCC {
    int V, ti = 0;
    vector<vector<int>> adj;
    vector<int> par, disc, low;
    vector<vector<pair<int, int>>> fin;
    vector<pair<int, int>> st;
    vector<int> comp;
    void init(int _V) {
       V = _V;
       par.resize(V), disc.resize(V), low.resize(V), adj.resize(V); comp.resize(V);
       for(int i= 0 ; i<V; i++){
            par[i] = disc[i] = low[i] = -1;
       }
    }
    void addEdge(int u, int v) {
       adj[u].push_back(v), adj[v].push_back(u);
    }

    void BCCutil(int u) {
        disc[u] = low[u] = ti++;
        int child = 0;
        for (int toAdd = 0; toAdd<4; toAdd++){
            int i = valid(u, toAdd);
            if(i == -1){
                continue;
            }
            if (i != par[u]) {
                if (disc[i] == -1) {
                     child ++; par[i] = u;
                     st.push_back({u,i});
                     BCCutil(i);
                     low[u] = min(low[u],low[i]);

                     if ((disc[u] == 0 && child > 1) || (disc[u] != 0 && disc[u] <= low[i])) { // checks for articulation point
                         vector<pair<int, int>> tmp;
                         while (st.back() != make_pair(u,i)) tmp.push_back(st.back()), st.pop_back();
                         tmp.push_back(st.back()), st.pop_back();
                         fin.push_back(tmp);
                      }
                }
                else if (disc[i] < disc[u]) {
                    low[u] = min(low[u],disc[i]);
                    st.push_back({u,i});
                }
            }
        }
    }

    void bcc() {
         for(int i = 0; i<V; i++){
            if (disc[i] == -1 && grid[i/m][i%m] == 0) {
                 BCCutil(i);
                 if (st.size()) fin.push_back(st);
                 st.clear();
             }
         }
         for(int i = 0; i<fin.size(); i++){
            for(int j = 0; j<fin[i].size(); j++){
                comp[fin[i][j].f] = i;
                comp[fin[i][j].s] = i;
            }
         }
    }
};

BCC b;
void bfs(int cow, int box, int dir){
    if(vis[box][dir] == 1){
        return;
    }
    //bfs
    list<pii> q;
    q.pb(mp(box, cow));
    vis[box][dir] = 1;
    while(!q.empty()){
        cow = q.front().s;
        box = q.front().f;
        q.pop_front();
        for(int i = 0; i<4; i++){
            // 0 down, 1 right, 2 up, 3 left
            int nxtCow = valid(box, (i+2)%4); //where cow has to be to move box in direction i
            int nxtBox = valid(box, i); //the next location of the box moved in direction i
            if(nxtCow == -1 || nxtBox == -1){ //checking if they are valid
                continue;
            }
            if((b.comp[cow] != b.comp[nxtCow])){ //seeing if it's possible for the cow to move to that new location
                continue;
            }
            if(vis[nxtBox][i] == 1){
                continue;
            }
            //adding to queue
            vis[nxtBox][i] = 1;
            q.push_back(mp(nxtBox, box));

        }
    }
}

void bfs1(int cow, int box){//bfs to find where cow can be around the initial position of box
    list<int> q;
    q.pb(cow);
    reach[cow] =1;
    while(!q.empty()){
        int s = q.front();
        q.pop_front();
        f0r(i, 4){
            int nxt = valid(s, i);
            if(nxt != -1 && nxt  != box && reach[nxt] == 0){
                reach[nxt] =  1;
                q.pb(nxt);
            }
        }
    }
}
int main(){
   // io("pushabox");
    cin >>n >>m >> q;
    string temporary;
    getline(cin, temporary);
    int cow = 0;
    int box = 0;
    //read input
    f0r(i, n){
        string line;
        getline(cin, line);
        f0r(j, m){
            if(line[j] == '#'){
                grid[i][j] = 1;
            }
            if(line[j] == 'A'){
                cow = i*m +j;
            }
            if(line[j] == 'B'){
                box = i*m+j;
            }
        }
    }
    //find the biconnected components
    b.init(n*m);
    b.bcc();
    //finds where the cow can be around the box
    bfs1(cow, box);
    f0r(i, 4){
        int nxtCow = valid(box, i);
        if(nxtCow != -1 && reach[nxtCow] == 1){
            //bfs from each location to figure which places you can visit
            bfs(nxtCow, box, (i+2)%4);
        }
    }
    f0r(i, q){
        int r, c;
        cin >> r >> c;
        r--; c--;
        int loc = r*m + c;
        if(vis[loc][0] == 1 || vis[loc][1] == 1 || vis[loc][2] == 1 || vis[loc][3] == 1 || loc == box){
            cout << "YES" << endl;
        }
        else{
            cout << "NO" << endl;
        }
    }
    return 0;
}
