#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MAXN = 2e5+5;


int n, m, k;
array<int,3> a[MAXN], b[MAXN];

int dist(int i, int j){
    int x = (a[i][0]-b[j][0]), y = (a[i][1]-b[j][1]);
    return x*x+y*y;
}

int f(int x, int y){
    int r = 0;
    for(int i = 0; i < k; ++i){
        r = max(r, dist(x+i,y+i));
    }
    return r;
}


void solve(){
    cin >> n >> m >> k;
    for(int i = 1; i <= n; ++i){
        cin >> a[i][0] >> a[i][1];
        a[i][2] = i;
    }
    for(int i = 1; i <= m; ++i){
        cin >> b[i][0] >> b[i][1];
        b[i][2] = i;
    }
    sort(a+1,a+n+1);
    sort(b+1,b+m+1);
    int ans = 2e18, idx1, idx2;
    int idx = 1;
    for(int i = 1; i+k-1 <= n; ++i){
        for(int j = 0; j+k-1 <= m; ++j){
            int tmp = f(i,j);
            if(tmp <= ans){
                ans = tmp;
                idx1 = i, idx2 = j;
                idx = j;
            }
        }
    }
    cout << ans << '\n';
    for(int i = 0; i < k; ++i){
        cout << a[idx1+i][2] << ' ' << b[idx2+i][2] << '\n';
    }
}

int32_t main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    int qqq=1;
    //cin>>qqq;
    while(qqq--) solve();
}