#include <bits/stdc++.h>
using namespace std;

long long kr(pair<long long,long long> p1, pair<long long,long long> p2)
{
    return (p1.first - p2.first)*(p1.first - p2.first)
    +(p1.second - p2.second)*(p1.second - p2.second);
}
int main()
{
    long long n,m,k,x,y;
    cin >> n >> m >> k;
    vector<pair<long long,long long>> mars;
    vector<pair<long long,long long>> nis;
    for ( int i = 0 ; i < n ; i++)
    {
        cin >> x >> y;
        nis.push_back(make_pair(x,y));
    }
    for ( int i = 0 ; i < m ; i++)
    {
        cin >> x >> y;
        mars.push_back(make_pair(x,y));
    }
    if ( k == 1)
    {
        int rn = -1,rm = -1;
        long long l = -1;
        long long r = max(kr(mars[0],nis[n-1]),kr(mars[m-1],nis[0])) + 1;
        long long res = r;
        while(r - l > 1)
        {
            long long mid = (r-l)/2 + l;
            bool nasli = false;
            for ( int i = 0 ; i < n ; i++)
            {
                int l2 = 0;
                int r2 = m-1;
                while(r2 - l2 > 1)
                {
                    int mid2 = (r2-l2)/2 + l2;
                    if ( kr(nis[i],mars[mid2])<= mid)
                    {
                        nasli = true;
                        rn = i;
                        rm = mid2;
                        res = mid;
                        i = n;
                        l2 = r2;
                    }
                    else
                    {
                        if ( kr(nis[i],mars[l2]) < kr(nis[i],mars[l2])) l2 = mid2;
                        else r2 = mid2;
                    }
                }
            }
            if ( nasli) r = mid;
            else l = mid;
        }
        cout << res << endl;
        cout << rn + 1 << " " << rm + 1;
    }
}