#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m,k;
    cin>>n>>m>>k;
    vector<pair<int,int>>a(n),b(m);
    for(int i=0;i<n;i++){
        cin>>a[i].first>>a[i].second;
    }
    for(int i=0;i<m;i++){
        cin>>b[i].first>>b[i].second;
    }
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    int res=min((a[0].first-b[m].first)*(a[0].first-b[m].first)+(a[0].second-b[m].second)*(a[0].second-b[m].second),(a[n].first-b[0].first)*(a[n].first-b[0].first)+(a[n].second-b[0].second)*(a[n].second-b[0].second));
    cout<<res<<'\n';
    return 0;
}