#include <bits/stdc++.h>

using namespace std;

long long d(pair<long long,long long> a, pair<long long,long long> b){

    return ((a.first - b.first) * (a.first - b.first) + (a.second - b.second) * (a.second - b.second));

}


bool sort_func(pair<long long, int>& a, pair<long long, int>& b){
    return a<b;
}


int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int n,m,k;

    cin>>n>>m>>k;

    vector<pair<long long,long long>> a(n);
    vector<pair<long long,long long>> b(m);

    for(int i=0;i<n;i++){
        cin>>a[i].first>>a[i].second;
    }
    for(int i=0;i<m;i++){
        cin>>b[i].first>>b[i].second;
    }

    sort(a.begin(), a.end());
    sort(b.begin(),b.end());


    vector<pair<long long, int>> dist;

    for(int i=0;i<k;i++){
        dist.push_back({d(a[i],b[i]), i+1});
    }

    sort(dist.begin(),dist.end(),sort_func);


    cout<<dist[k-1].first<<'\n';

    for(int i = k-2;i<min(n,m);i++){
        cout<<dist[i].second<<" "<<dist[i].second<<'\n';
    }





    return 0;
}