#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define endl "\n"
///freopen("input.txt", "r", stdin);
///freopen("output.txt", "w", stdout);
void solve(){
    int n,m,k;
    cin>>n>>m>>k;

    vector<pair<int,int>>niz1(n);
    for(int i=0;i<n;i++){
        cin>>niz1[i].first>>niz1[i].second;
    }

    vector<pair<int,int>>niz2(m);
    for(int i=0;i<m;i++){
        cin>>niz2[i].first>>niz2[i].second;
    }

    if(niz1[n-1].first>niz2[0].first){
        swap(niz1,niz2);
        swap(n,m);
    }

    ll ans=0;
    for(int i=n-1,j=k-1,x=0;i>=0&&x<k;i--,j--,x++){
        ll x1=niz1[i].first;
        ll x2=niz2[j].first;
        ///cout<<x1<<" "<<x2<<endl;

        ll xovi=abs(x1-x2);

        ll dist=xovi*xovi;
        ans=max(ans,dist);
    }

    ll y=abs(niz1[0].second-niz2[0].second);
    ans+=(y*y);
    cout<<ans<<endl;
    for(int i=n-1,j=k-1,x=0;i>=0&&x<k;i--,j--,x++){
        cout<<i<<" "<<j<<endl;
    }
}
/*****
3 3 2
4 4
5 4
6 4
0 2
1 2
2 2




*****/
int main(){
    ios_base::sync_with_stdio(false);cin.tie(0);
    int t=1;///cin>>t;
    while(t--)solve();
    return 0;
}