#include <cstdio>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <queue>
using namespace std;
#define ll long long
#define kd int
#define fors(i,a,b) for(int i=(a);i<=(b);++i)
inline kd read(){
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9'){if(c=='-') f=-1;c=getchar();}
	while(c>='0'&&c<='9') {x=(x<<3)+(x<<1)+c-'0';c=getchar();}
	return x*=f;
}
inline void write(kd x){
	if(x<0) {putchar('-');x=-x;}
	if(x>9) write(x/10);
	putchar(x%10+'0');
}
inline min(int x,int y){
	return x>y ? y:x;
}
const int maxn=1<<25;
int main(){
	register int n,m,a[100001],b[100001],x[100001],y[100001];
	n=read(),m=read();
	fors(i,1,n)
		a[i]=read(),b[i]=read();
	fors(i,1,m)
		x[i]=read(),y[i]=read();
	fors(i,1,n){
	int ans=maxn;
	fors(j,1,m){
		int tmp=abs(b[m]-y[m])+abs(a[m]-x[m]);
		ans=min(ans,tmp);
	}
	cout<<ans<<endl;
}
    return 0;
}