#include <cstdio>
using namespace std;
template<typename Elm,typename Swo>
void heap_shift_right(Elm*A,int i,int n,Swo swo)
{ int root=i, child;
while(root<n)
{ child=-1+(root+1)*2;
if(n>(1+child))
{ if(swo(A[child+1],A[child]))
{++child;}
}
if(swo(A[child],A[root]))
{ A[root].swap(A[child]);
root=child;
}
else
{root=n;}
}
}
template<typename Elm,typename Swo>
void heap_shift_left(Elm*A,int i,Swo swo)
{ int root=i,child;
while(0<root)
{ child=(root-1)/2;
if(swo(A[root],A[child]))
{ A[root].swap(A[child]);
root=child;
}
else
{root=0;}
}
}
struct Eij
{ void swap(Eij&o)
{ int a;
a=v;v=o.v;o.v=a;
a=j;j=o.j;o.j=a;
t[j]=i;t[o.j]=o.i;
}
void init(short int av,short int ai, short int aj,short int*at)
{v=av;i=ai;j=aj;t=at;t[j]=i;}
short int * t;
short int v,i,j;
};
bool swoMin(Eij const&a,Eij const&b){return a.v<b.v;}
bool swoMax(Eij const&a,Eij const&b){return a.v>b.v;}
int const maxm=1000,maxn=1000,minv=0,maxv=8000;
short int A[maxn][maxm],Imin[maxn][maxm],Imax[maxn][maxm],Pmin[maxn],Pmax[maxn],
M,N,P,di,dj,opt,cnt;
Eij Amin[maxn][maxm],Amax[maxn][maxm],Lmin[maxn],Lmax[maxn];
void solve()
{ short int i,j,val,ii,jj;
for(i=0;N>i;++i)
{ for(j=0;dj>j;++j)
{ Amin[i][j].init(A[i][j],j,j,&Imin[i][0]);
heap_shift_left(&Amin[i][0],j,swoMin);
Amax[i][j].init(A[i][j],j,j,&Imax[i][0]);
heap_shift_left(&Amax[i][0],j,swoMax);
}
}
for(j=dj-1;M>j;++j)
{ for(i=0;di>i;++i)
{ Lmin[i].init(Amin[i][0].v,i,i,&Pmin[0]);
heap_shift_left(&Lmin[0],i,swoMin);
Lmax[i].init(Amax[i][0].v,i,i,&Pmax[0]);
heap_shift_left(&Lmax[0],i,swoMax);
}
for(i=di-1;N>i;++i)
{ val=Lmax[0].v-Lmin[0].v;
if(val<opt){opt=val;cnt=1;}
else{if(val==opt){++cnt;}}
if(N>(i+1))
{ ii=Pmin[i-di+1];Lmin[ii].v=1+maxv;
heap_shift_right(&Lmin[0],ii,di,swoMin);
ii=di-1;Lmin[ii].init(Amin[i+1][0].v,ii,i+1,&Pmin[0]);
heap_shift_left(&Lmin[0],ii,swoMin);
ii=Pmax[i-di+1];Lmax[ii].v=minv-1;
heap_shift_right(&Lmax[0],ii,di,swoMax);
ii=di-1;Lmax[ii].init(Amax[i+1][0].v,ii,i+1,&Pmax[0]);
heap_shift_left(&Lmax[0],ii,swoMax);
}
}
if(M>(j+1))
{ for(i=0;N>i;++i)
{ jj=Imin[i][j-dj+1];Amin[i][jj].v=1+maxv;
heap_shift_right(&Amin[i][0],jj,dj,swoMin);
jj=dj-1;Amin[i][jj].init(A[i][j+1],jj,j+1,&Imin[i][0]);
heap_shift_left(&Amin[i][0],jj,swoMin);
jj=Imax[i][j-dj+1];Amax[i][jj].v=minv-1;
heap_shift_right(&Amax[i][0],jj,dj,swoMax);
jj=dj-1;Amax[i][jj].init(A[i][j+1],jj,j+1,&Imax[i][0]);
heap_shift_left(&Amax[i][0],jj,swoMax);
}
}
}
}
int main()
{ freopen("struti.in","r",stdin);
freopen("struti.out","w",stdout);
int i,j;
scanf("%hd %hd %hd",&N,&M,&P);
for(j=0;M>j;++j)
{ for(i=0;N>i;++i)
{scanf("%hd",&A[i][j]);}
}
for(i=0;P>i;++i)
{ scanf("%hd %hd",&di,&dj);
opt=maxv-minv+1;cnt=0;
solve();
if(di!=dj)
{ j=di;di=dj;dj=j;
solve();
}
printf("%hd %hd\n",opt,cnt);
}
return 0;
}