#include <bits/stdc++.h>

using namespace std;

long long dist(pair<long long, long long> x, pair<long long, long long> y) {
    long long first = x.first - y.first;
    long long second = x.second - y.second;
    return first*first + second*second;
}

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

    int n, m, k;
    cin >> n >> m >> k;
    vector<pair<long long, long long>> first(n);
    vector<pair<long long, long long>> second(m);

    for (int i = 0; i < n; i++) {
        cin >> first[i].first >> first[i].second;
    }

    for (int i = 0; i < m; i++) {
        cin >> second[i].first >> second[i].second;
    }

    long long minimum = LLONG_MAX;
    pair<long long, long long> maxcords;
    for (int i = 0; i <= n - k; i++) {
        for (int j = 0; j <= m - k; j++) {
            long long max = 0;
            for (int l = 0; l < k; l++) {
                int d = dist(first[i + l], second[j + l]);
                if (d > max) max = d;
            }

            if (minimum > max) {
                minimum = max;
                maxcords = {i, j};
            }
        }
    }

    cout << minimum << endl;
    for (int l = 1; l <= k; l++) {
        cout << maxcords.first + l << " " << maxcords.second + l << endl;
    }

    return 0;
}