#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define sc second
#define endl "\n"
#define pii pair<int,int>

using namespace std;

const int MAXN = 1e5+5;
const int mod7 = 1e9+7;
const long long inf = 1e18;

int kvadrat(int x)
{
    return x*x;
}


signed main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n,m,k;
    cin >> n >> m >> k;
    vector<pii> mars(n);
    vector<pii> nis(m);
    for(int i=0; i<n; i++)cin >> mars[i].fi >> mars[i].sc;
    for(int i=0; i<m; i++)cin >> nis[i].fi >> nis[i].sc;
    if(n == 1 && m == 1)
    {
        cout << kvadrat(mars[0].fi - nis[0].fi) + kvadrat(mars[0].sc - nis[0].sc) << endl;
        cout << 1 << " " << 1 << endl;
    }
    else if(n<=10 && m<=10)
    {
        int mn = inf;
        vector<pii> rez;
        for(int i=0; i<=n-k; i++)
        {
            for(int j=0; j<=m-k; j++)
            {
                vector<pii> trrez;
                int trmn = 0;
                for(int r = 0; r<k; r++)
                {
                    trmn = max(trmn, kvadrat(mars[i+r].fi - nis[j+r].fi) + kvadrat(mars[i+r].sc - nis[j+r].sc));
                    trrez.pb({i+r+1, j+r+1});
                }
                if(trmn < mn)
                {
                    rez = trrez;
                    mn = trmn;
                }

            }
        }
        cout << mn << endl;
         for(auto x: rez)cout << x.fi << " " << x.sc << endl;

    }
    else if(nis[m-1].fi <= mars[0].fi)
    {
        vector<pii> rez;
        int mn = 0;
        for(int i=0; i<k; i++)
        {
            rez.pb({i+1,m-k+i+1});
            mn=max(mn,kvadrat(nis[m-k+i].fi - mars[i].fi) + kvadrat(nis[m-k+i].sc - mars[i].sc));
        }
        cout << mn << endl;
        for(auto x: rez)cout << x.fi << " " << x.sc << endl;
    }
    else if(nis[0].fi >= mars[n-1].fi)
    {
        vector<pii> rez;
        int mn = 0;
        for(int i=0; i<k; i++)
        {
            rez.pb({n-k+i+1,i+1});
            mn=max(mn,kvadrat(nis[i].fi - mars[n-k+i].fi) + kvadrat(nis[i].sc - mars[n-k+i].sc));
        }
        cout << mn << endl;
        for(auto x: rez)cout << x.fi << " " << x.sc << endl;
    }

    else if(k == 1)
    {
        int l = 0;
        int r = 0;
        vector<pii> rez(n, {inf,0});
        while(l < n && r < m)
        {
            int tr = kvadrat(nis[r].fi - mars[l].fi) + kvadrat(nis[l].sc - mars[r].sc);
            if(l == n-1 || tr < rez[l].fi)
            {
                rez[l].fi = tr;
                rez[l].sc = r;
                r++;
            }
            else
            {
                r--;
                l++;
            }
        }
        int mn = inf;
        pii rez2;
        for(int i=0; i<n; i++)
        {
            if(rez[i].fi < mn)
            {
                rez2.fi = i;
                rez2.sc = rez[i].sc;
                mn  = rez[i].fi;
            }
        }
        cout << mn << endl;
        cout << rez2.fi+1 << " " <<rez2.sc+1 << endl;

    }





}