#include using namespace std; int main() { int a, b, vx, vy; int minim = 0; cin >> a; cin >> b; int *poleG = new int[2*a]; int *poleP = new int[2*b]; for(int i = 0; i<2*a; i+=2) { cin >> poleG[i]; cin >> poleG[i+1]; } for(int i = 0; i<2*b; i+=2) { cin >> poleP[i]; cin >> poleP[i+1]; } for(int i=0; i<2*b; i+=2) { for(int j = 0; j<2*a; j+=2) { vx = poleP[i] - poleG[j]; if(vx<0) { vx*=-1; } vy = poleP[i+1] - poleG[j+1]; if(vy<0) { vy *=-1; } if(vx>vy) { vy = 0; } else { vx = 0; } if(j==0) { minim = vx+vy; } if((vx + vy) < minim) { minim = vx + vy; } } cout << minim << endl; } delete poleP; delete poleG; return 0; }