#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define ll long long
#define mp make_pair
#define ld long double
const int N=2e5+50;
const ll INF=1e18;
int n,m,K;
vector<pair<int,int>>a,b;
ll Dist(pair<int,int>A,pair<int,int>B){return (ll)(A.fi-B.fi)*(A.fi-B.fi)+(ll)(A.se-B.se)*(A.se-B.se);}
int L[N],R[N];
struct BIT{
    ll T[2*N+10];
    void Update(int i,ll x){for(i+=N;i<=2*N+5;i+=i&-i)T[i]+=x;}
    ll Get(int i){ll x=0;for(i+=N;i>=1;i-=i&-i)x+=T[i];return x;}
    ll Get(int l,int r){return Get(r)-Get(l-1);}
    void Clear(){for(int i=0;i<=2*N+5;i++)T[i]=0;}
}bt[2];
int IND;
void CalcInterval(ll k){
    for(int i=1;i<=n;i++){
        L[i]=m+1;R[i]=0;
        for(int j=1;j<=m;j++)if(Dist(a[i],b[j])<=k)R[i]=j;
        for(int j=m;j>=1;j--)if(Dist(a[i],b[j])<=k)L[i]=j;
        //printf("%i: %i %i\n",i,L[i],R[i]);
    }
}
bool Check(ll k){
    CalcInterval(k);
    //bt[0].Clear();
    //bt[1].Clear();
    for(ll i=1,num0=0,num1=0;i<=n;i++){
        /*if(i>K){
            bt[0].Update(L[i-K]-(i-K),-1);
            bt[1].Update(R[i-K]-(i-K),-1);
            num0-=bt[0].Get(R[i-K]-(i-K)+1,N);
            num1-=bt[1].Get(L[i-K]-(i-K)-1);
        }
        num0+=bt[1].Get(L[i]-i-1);
        num1+=bt[0].Get(R[i]-i+1,N);
        bt[0].Update(L[i]-i,1);
        bt[1].Update(R[i]-i,1);
        if(i>=K&&num0==0&&num1==0){
            IND=i-K+1;
            return true;
        }*/
        if(i>=K){
            bool moze=true;
            for(int l=i-K+1;l<=i;l++)for(int r=l;r<=i;r++){
                if(R[l]-l<L[r]-r||L[l]-l>R[r]-r)moze=false;
            }
            if(moze){
                IND=i-K+1;
                return true;
            }
        }
    }
    return false;
}
vector<pair<int,int>>Construct(ll k){
    Check(k);
    vector<pair<int,int>>res;
    for(int j=L[IND];j<=R[IND];j++){
        if(L[IND+K-1]<=j+K-1&&j+K-1<=R[IND+K-1]){
            for(int k=0;k<=K-1;k++)res.pb({IND+k,j+k});
            break;
        }
    }
    return res;
}
int main(){
    scanf("%i%i%i",&n,&m,&K);
    a.resize(n);
    b.resize(m);
    for(int i=1;i<=n;i++)scanf("%i%i",&a[i].fi,&a[i].se);
    for(int i=1;i<=m;i++)scanf("%i%i",&b[i].fi,&b[i].se);
    ll l=0,r=INF,res=INF;
    while(l<=r){
        ll mid=l+r>>1;
        if(Check(mid))res=mid,r=mid-1;
        else l=mid+1;
    }
    printf("%lld\n",res);
    for(auto [u,v]:Construct(res))printf("%i %i\n",u,v);
    return 0;
}