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

typedef long long ll;
typedef vector<int> vi;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n,m,k;
    cin >> n>>m>>k;

    vector<pair<int,int>> nis, mars;
    for(int i = 0; i < n; i++) {
            int l,r;
        cin >> l >> r;
        nis.push_back({l,r});
    }
    for(int i = 0; i < m; i++) {
            int l,r;
        cin >> l >> r;
        mars.push_back({l,r});
    }

    int maxx = INT_MAX;
    pair<int,int> idx = {-1,-1};
    for (int i = 0; i <= (n-k); i++) {
        for (int j = 0; j <= (m-k); j++) {
            int submax = -1;
            for (int x = 0; x < k; x++) {
                submax = max(submax, (nis[i+x].first - mars[j+x].first)*(nis[i+x].first - mars[j+x].first) + (nis[i+x].second - mars[j+x].second)*(nis[i+x].second - mars[j+x].second));
            }
            maxx = min(submax, maxx);
            if (maxx == submax) {
                idx = {i,j};
            }
        }
    }

    cout << maxx << '\n';
    for (int i = 1; i <= k; i++) {
        cout << idx.first+i << ' ' << idx.second+i << '\n';
    }
}