#include <bits/stdc++.h>
#define fst first
#define snd second
#define forn(i,a,b) for(int i = a; i<b; i++)
using namespace std;
typedef long long ll;
vector<pair<ll,ll>> oper = {{1,1},{1,-1},{1,0},{0,1},{0,-1},{-1,0},{-1,-1},{-1,1}};
int main(){
ll n,m,b; cin>>n>>m>>b;
vector<vector<ll>> v(n,vector<ll>(m,0));
forn(i,0,b){
ll x,y; cin>>x>>y; x--; y--;
v[x][y]=-1;
for(auto o:oper){
if(x+o.fst>=0 && x+o.fst<n){
if(y+o.snd>=0 && y+o.snd<m){
if(v[x+o.fst][y+o.snd]>-1){
v[x+o.fst][y+o.snd]++;
}
}
}
}
}
forn(i,0,n){
forn(j,0,m){
if(v[i][j]!=-1) cout<<v[i][j]<<" ";
else cout<<"B ";
}cout<<'\n';
}
return 0;
}