#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ll long long
#define ff first
#define ss second
#define int long long
using namespace std;

const ll INF = 2'000'000'000'000'000'010;
int n, m, k;
vector < pair < int , int > > vp;
vector < pair < int , int > > vv;

bool frth()
{
    vector < pair < int , int > > vp1 = vp;
    vector < pair < int , int > > vv1 = vv;
    bool b = true;

//    cout << "nis: ";
//    for(int i = 0; i < n; i++) cout << vp1[i].ff << " " << vp1[i].ss << " , ";
//    cout << "\n";
//
//    cout << "mar: ";
//    for(int i = 0; i < m; i++) cout << vv1[i].ff << " " << vv1[i].ss << " , ";
//    cout << "\n";


    for(int i = 1; i < n; i++) if(vp1[i].ss != vp1[i - 1].ss) b = false;
    for(int i = 1; i < m; i++) if(vv1[i].ss != vv1[i - 1].ss) b = false;


    return ( (vp1[0].ff > vv1.back().ff || vv1[0].ff > vp1.back().ff) && b);
}

ll dist(pair < int , int > a, pair < int , int > b)
{
    return (ll)(a.ff - b.ff) * (a.ff - b.ff) + (ll)(a.ss - b.ss) * (a.ss - b.ss);
}

signed main()
{
    FAST;

    cin >> n >> m >> k;
    vp.resize(n);
    for(int i = 0; i < n; i++) cin >> vp[i].ff >> vp[i].ss;
    vv.resize(m);
    for(int i = 0; i < m; i++) cin >> vv[i].ff >> vv[i].ss;

    if(n <= 10 && m <= 10)
    {
        ll res = INF;
        int ii = 0; int jj = 0;
        for(int i = 0; i <= n - k; i++)
        {
            for(int j = 0; j <= m - k; j++)
            {
                ll ans = 0;
                for(int ij = 0; ij < k; ij++) ans = max(ans, dist(vp[i + ij], vv[j + ij]));
                if(ans < res) { res = ans; ii = i; jj = j; }
            }
        }
        cout << res << "\n";
        for(int i = 0; i < k; i++) cout << ii + i + 1 << " " << jj + i + 1 << "\n";
        return 0;
    }

    if(frth())
    {
//        cout << "in\n";
        ll ans = 0;
        if(vp[0].ff > vv.back().ff)
        {
            for(int i = 0; i < k; i++)
                ans = max(ans, dist(vp[i], vv[m - k + i]));

            cout << ans << "\n";
            for(int i = 1; i <= k; i++) cout << i << " " << m - k + i << "\n";

            return 0;
        }

        for(int i = 0; i < k; i++)
            ans = max(ans, dist(vp[n - k + i], vv[i]));

        cout << ans << "\n";
        for(int i = 1; i <= k; i++) cout << n - k + i << " " << i << "\n";
        return 0;
    }



    cout << "0\n";



    return 0;
}

//5 4 3
//1 1
//2 1
//3 1
//4 1
//6 1
//8 2
//9 2
//10 2
//11 2