#include <bits/stdc++.h>

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n,m,k;
    cin>>n>>m>>k;
    vector<pair<int,int>>nis;
    vector<pair<int,int>>mars;
    vector<vector<int>>uda(m);
    for(int i=0;i<n;i++){
        int x,y;
        cin>>x>>y;
        nis.push_back(make_pair(x,y));
    }
    for(int i=0;i<m;i++){
        int x,y;
        cin>>x>>y;
        for(int j=0;j<n;j++){
            uda[i].push_back(abs(nis[j].first-x)*abs(nis[j].first-x)+abs(nis[j].second-y)*abs(nis[j].second-y));
        }
        mars.push_back(make_pair(x,y));
    }
    vector<int>poz;
    int makxmini=1000000000;
    int pozm=-1;
    int pozn=-1;
    for(int i=0;i<m;i++){
        int mini=100000000;
        int poz1=-1;

        for(int j=0;j<n;j++){
            if(mini>uda[i][j]){
                poz1=j;
                mini=uda[i][j];
            }
        }
        if(makxmini>mini){
            makxmini=mini;
            pozm=i;
            pozn=poz1;
        }

    }
    if(k==1){
        cout<<makxmini<<endl;
        cout<<pozn+1;
        cout<<" ";
        cout<<pozm+1;
    }

}