clude <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct Zone {
int x, y;
int distToHong;
int distToExit;
};
bool compare(const Zone& a, const Zone& b) {
if (a.distToHong != b.distToHong) {
return a.distToHong < b.distToHong;
}
return a.distToExit < b.distToExit;
}
int main() {
int x_hong, y_hong;
cin >> x_hong >> y_hong;
int n;
cin >> n;
vector<Zone> zones(n);
for (int i = 0; i < n; i++) {
cin >> zones[i].x >> zones[i].y;
zones[i].distToHong = abs(zones[i].x - x_hong) + abs(zones[i].y - y_hong);
zones[i].distToExit = zones[i].x + zones[i].y;
}
sort(zones.begin(), zones.end(), compare);
cout << zones[0].x << " " << zones[0].y << endl;
return 0;
}
/**************************************************************
Problem: 1347
User: panyuchen
Language: C++
Result: Compile Error
****************************************************************/