#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
using namespace std;

const ll INF = 1'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;

    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;

    sort(begin(vp1), end(vp1));
    sort(begin(vv1), end(vv1));

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


int 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(frth())
    {
        ll ans = INF;
        sort(begin(vp), end(vp));
        sort(begin(vv), end(vv));

        if(vp[0].ff > vv.back().ff)
        {
            for(int i = 0; i < k; i++)
                ans = min(ans, (ll)(vp[i].ff - vv[m - k + i].ff) * (vp[i].ff - vv[m - k + i].ff));

            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 = min(ans, (ll)(vv[i].ff - vp[n - k + i].ff) * (vv[i].ff - vp[n - k + i].ff));

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

    cout << "0\n";



    return 0;
}