#include <bits/stdc++.h>
#define int long long
using namespace std;
vector<pair<int,int>>nis,mars;
int n,m,k;
int euklid(pair<int,int> ni,pair<int,int> ma){
return (ni.first-ma.first)*(ni.first-ma.first)+(ni.second-ma.second)*(ni.second-ma.second);
}
int dist(int np,int mp){
if(np+k-1>=n)
return -1;
if(mp+k-1>=m)
return -1;
int maxi=-1;
for(int i = 0;i<k;i++){
maxi=max(maxi,euklid(nis[np+i],mars[mp+i]));
}
return maxi;
}
signed main()
{
cin>>n>>m>>k;
nis.resize(n);
mars.resize(m);
for(int i = 0;i<n;i++){
int x,y;
cin>>x>>y;
nis[i]={x,y};
}
for(int i = 0;i<m;i++){
int x,y;
cin>>x>>y;
mars[i]={x,y};
}
sort(nis.begin(),nis.end());
sort(mars.begin(),mars.end());
pair<int,int>idxres;
int mini=2100000000000000000;
for(int i = 0;i<=n;i++){
for(int j = 0;j<=m;j++){
if(dist(i,j)!=-1){
if(mini>dist(i,j)){
mini=min(mini,dist(i,j));
idxres.first=i;
idxres.second=j;
}
}
}
}
cout<<mini<<endl;
for(int i = 0;i<k;i++)
cout<<idxres.first+i+1<<" "<<idxres.second+i+1<<endl;
    return 0;
}