#include <iostream>
#include <cstdio>
#include <deque>
#define N 1005
using namespace std;
int n,m,t;
int a[N][N];
int sol, nr;
deque <pair<int,int>> lmin, lmax,cmin[N],cmax[N];
void adauga(int i, pair<int,int> val, int d){
while(!lmin.empty() && lmin.back().first>val.first)
lmin.pop_back();
lmin.push_back({val.first,i});
if(i-lmin.front().second+1>d)
lmin.pop_front();
while(!lmax.empty() && lmax.back().first<val.second)
lmax.pop_back();
lmax.push_back({val.second,i});
if(i-lmax.front().second+1>d)
lmax.pop_front();
}
void adaugaColoana(int j, int i,pair<int,int> val, int d){
while(!cmin[j].empty() && cmin[j].back().first>val.first)
cmin[j].pop_back();
cmin[j].push_back({val.first,i});
if(i-cmin[j].front().second+1>d)
cmin[j].pop_front();
while(!cmax[j].empty() && cmax[j].back().first<val.second)
cmax[j].pop_back();
cmax[j].push_back({val.second,i});
if(i-cmax[j].front().second+1>d)
cmax[j].pop_front();
}
void solve(int dx, int dy){
for(int i = 1; i <= m; ++i)
cmin[i].clear(), cmax[i].clear();
for(int i = 1; i < dx; ++i)
for(int j = 1; j <= m; ++j)
adaugaColoana(j,i,{a[i][j],a[i][j]},dx);
for(int i = dx; i <= n; ++i){
lmin.clear();
lmax.clear();
for(int j = 1; j <= m; ++j){
adaugaColoana(j,i,{a[i][j],a[i][j]},dx);
adauga(j,{cmin[j].front().first,cmax[j].front().first},dy);
if(j>=dy){
int dif = lmax.front().first - lmin.front().first;
if(dif==sol)
++nr;
else if(dif<sol){
sol = dif;
nr = 1;
}
}
}
}
}
int main()
{
freopen("struti.in","r",stdin);
freopen("struti.out","w",stdout);
scanf("%d%d%d", &n,&m,&t);
for(int i = 1; i <= n; ++i)
for(int j = 1; j <= m; ++j)
scanf("%d", &a[i][j]);
int dx,dy;
for(int i = 0; i < t; ++i){
scanf("%d%d", &dx,&dy);
sol = 10000;
nr = 0;
solve(dx,dy);
if(dx!=dy)
solve(dy,dx);
cout<<sol<<" "<<nr<<"\n";
}
return 0;
}