#include"bits/stdc++.h"
#define inf 0x3f3f3f3f
#define MM 800400
#define NN 200100
#define y second
#define x first

using namespace std;
typedef pair<int, int> pii;
typedef pair<pii, int> pi3;
template<typename A, typename B> inline void smin(A &a, const B &b) {if(a>b) a=b;}
template<typename A, typename B> inline void smax(A &a, const B &b) {if(a<b) a=b;}

int id[NN], LL[MM], RR[MM];
int x[NN], y[NN], xmn[MM], xmx[MM], ymn[MM], ymx[MM];

inline void select(int L, int mid, int R, int *val) {
	R--; int i, j, p, S, X;
	while(L+1<=R) {
		if(L+1==R) {
			if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
			return ;
		}
		S=L+1, X=S+rand()*rand()%(R-L);
		swap(id[L], id[X]);
		if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
		if(val[id[L]]>val[id[S]]) swap(id[L], id[S]);
		if(val[id[S]]>val[id[R]]) swap(id[S], id[R]);
		i=L, j=R, p=val[id[S]];
		while(true) {
			while(i<=R && val[id[i]]<=p) i++;
			while(j>=L && val[id[j]]>=p) j--;
			if(i>j) break; swap(id[i], id[j]);
		}
		if(mid<=j) R=j;
		else if(mid>=i) L=i;
		else break;
	}
}

inline void build(int u, int L, int R, int dp=0) {
	LL[u]=L, RR[u]=R;
	if(L+1==R) {
		xmn[u]=xmx[u]=x[id[L]];
		ymn[u]=ymx[u]=y[id[L]];
		return ;
	}
	int ls=u<<1, rs=ls|1, mid=L+R>>1;

	if(dp) select(L, mid, R, x);
	else select(L, mid, R, y);

	dp^=1;
	build(ls, L, mid, dp);
	build(rs, mid, R, dp);

	xmn[u]=min(xmn[ls], xmn[rs]), xmx[u]=max(xmx[ls], xmx[rs]);
	ymn[u]=min(ymn[ls], ymn[rs]), ymx[u]=max(ymx[ls], ymx[rs]);
}

pi3 p[NN];
int X, Y, I, mn;
int n, k, ax, ay, bx, by;

inline bool find(int u) {
	int L=LL[u], R=RR[u];
	if(R-L<=4) {
		for(int i=L; i<R; i++) if(id[i]<=k) {
			smin(mn, max(abs(X-x[id[i]]), abs(Y-y[id[i]])));
		}
		return true;
	}
	if(X<xmn[u] || xmx[u]<X || Y<ymn[u] || ymx[u]<Y) return false;
	int ls=u<<1;
	if(find(ls)) return true;
	return find(ls|1);
}

inline void calc(int u) {
	int x_x=0, y_y=0;
	if(X>xmx[u]) x_x=X-xmx[u];
	if(X<xmn[u]) x_x=xmn[u]-X;
	if(Y>ymx[u]) y_y=Y-ymx[u];
	if(Y<ymn[u]) y_y=ymn[u]-Y;
	if(max(x_x, y_y)>mn) return ;
	int L=LL[u], R=RR[u];
	if(L+1==R) {
		if(id[L]<=k) smin(mn, max(abs(X-x[id[L]]), abs(Y-y[id[L]])));
		return ;
	}
	int ls=u<<1;
	calc(ls), calc(ls|1);
}

inline bool in(int u) {
	if( bx<xmn[u] || xmx[u]<ax  ||  by<ymn[u] || ymx[u]<ay) return false;
	if(ax<=xmn[u] && xmx[u]<=bx && ay<=ymn[u] && ymx[u]<=by) return true;
	if(LL[u]+1==RR[u]) return false;
	int ls=u<<1;
	if(in(ls)) return true;
	return in(ls|1);
}

inline bool can(int d) {
	ax=ay=-inf, bx=by=inf;
	for(int i=1; i<=n; i++) {
		if(ax<=bx && ay<=by) {
			if(k && p[i].y<=d) {
				int T=d-p[i].y;
				ax-=T, ay-=T, bx+=T, by+=T;
				if(in(1)) return true;
				ax+=T, ay+=T, bx-=T, by-=T;
			}
		}
		else return false;
		X=p[i].x.x, Y=p[i].x.y;
		smax(ax, X-d), smin(bx, X+d);
		smax(ay, Y-d), smin(by, Y+d);
	}
	return ax<=bx && ay<=by;
}

main() {
#ifndef ONLINE_JUDGE
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
#endif

	srand(time(0));

	scanf("%d %d", &n, &k);
	for(int i=1, x, y; i<=n; i++) {
		scanf("%d %d", &x, &y);
		p[i].x={x-y, x+y};
	}
	if(k) {
		for(int i=1, x, y; i<=k; i++) {
			scanf("%d %d", &x, &y);
			::x[i]=x-y, ::y[i]=x+y, id[i]=i;
		}
		for(int i=1, u; i<=n; i++) {
			u=k+i;
			x[u]=p[i].x.x, y[u]=p[i].x.y, id[u]=u;
		}
		build(1, 1, k+n+1);

		for(int i=1; i<=n; i++) {
			mn=inf, I=k+i;
			X=p[i].x.x, Y=p[i].x.y;
			find(1), calc(1);
			p[i].y=mn;
		}
		sort(p+1, p+n+1, [](pi3 a, pi3 b) {return a.y>b.y;});

		for(int i=1; i<=k; i++) id[i]=i;
		build(1, 1, k+1);
	}
	int st=-1, ed=200000000;
	while(ed-st>1) {
		int md=st+ed>>1;
		if(can(md)) ed=md;
		else st=md;
	}
	printf("%d", ed);
}


#include"bits/stdc++.h"
#define inf 0x3f3f3f3f
#define MM 400400
#define NN 100100
#define y second
#define x first

using namespace std;
typedef pair<int, int> pii;
typedef pair<pii, int> pi3;
template<typename A, typename B> inline void smin(A &a, const B &b) {if(a>b) a=b;}
template<typename A, typename B> inline void smax(A &a, const B &b) {if(a<b) a=b;}

int id[NN], LL[MM], RR[MM];
int x[NN], y[NN], xmn[MM], xmx[MM], ymn[MM], ymx[MM];

inline void select(int L, int mid, int R, int *val) {
	R--; int i, j, p, S, X;
	while(L+1<=R) {
		if(L+1==R) {
			if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
			return ;
		}
		S=L+1, X=S+rand()*rand()%(R-L);
		swap(id[L], id[X]);
		if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
		if(val[id[L]]>val[id[S]]) swap(id[L], id[S]);
		if(val[id[S]]>val[id[R]]) swap(id[S], id[R]);
		i=L, j=R, p=val[id[S]];
		while(true) {
			while(i<=R && val[id[i]]<=p) i++;
			while(j>=L && val[id[j]]>=p) j--;
			if(i>j) break; swap(id[i], id[j]);
		}
		if(mid<=j) R=j;
		else if(mid>=i) L=i;
		else break;
	}
}

inline void build(int u, int L, int R, int dp=0) {
	LL[u]=L, RR[u]=R;
	if(L+1==R) {
		xmn[u]=xmx[u]=x[id[L]];
		ymn[u]=ymx[u]=y[id[L]];
		return ;
	}
	int ls=u<<1, rs=ls|1, mid=L+R>>1;

	if(dp) select(L, mid, R, x);
	else select(L, mid, R, y);

	dp^=1;
	build(ls, L, mid, dp);
	build(rs, mid, R, dp);

	xmn[u]=min(xmn[ls], xmn[rs]), xmx[u]=max(xmx[ls], xmx[rs]);
	ymn[u]=min(ymn[ls], ymn[rs]), ymx[u]=max(ymx[ls], ymx[rs]);
}

pi3 p[NN];
int X, Y, mn;

inline bool find(int u) {
	int L=LL[u], R=RR[u];
	if(R-L<=2) {
		for(int i=L; i<R; i++) {
			smin(mn, max(abs(X-x[id[i]]), abs(Y-y[id[i]])));
		}
		return true;
	}
	int ls=u<<1;
	if(find(ls)) return true;
	return find(ls|1);
}

inline void calc(int u) {
	int x_x=0, y_y=0;
	if(X>xmx[u]) x_x=X-xmx[u];
	if(X<xmn[u]) x_x=xmn[u]-X;
	if(Y>ymx[u]) y_y=Y-ymx[u];
	if(Y<ymn[u]) y_y=ymn[u]-Y;
	if(max(x_x, y_y)>mn) return ;
	int L=LL[u], R=RR[u];
	if(L+1==R) {
		smin(mn, max(abs(X-x[id[L]]), abs(Y-y[id[L]])));
		return ;
	}
	int ls=u<<1;
	calc(ls), calc(ls|1);
}

int n, k, ax, ay, bx, by;

inline bool in(int u) {
	if( bx<xmn[u] || xmx[u]<ax  ||  by<ymn[u] || ymx[u]<ay) return false;
	if(ax<=xmn[u] && xmx[u]<=bx && ay<=ymn[u] && ymx[u]<=by) return true;
	if(LL[u]+1==RR[u]) return false;
	int ls=u<<1;
	if(in(ls)) return true;
	return in(ls|1);
}

inline bool can(int d) {
	ax=ay=-inf, bx=by=inf;
	for(int i=1; i<=n; i++) {
		if(ax<=bx && ay<=by) {
			if(k && p[i].y<=d) {
				int T=d-p[i].y;
				ax-=T, ay-=T, bx+=T, by+=T;
				if(in(1)) return true;
				ax+=T, ay+=T, bx-=T, by-=T;
			}
		}
		else return false;
		X=p[i].x.x, Y=p[i].x.y;
		smax(ax, X-d), smin(bx, X+d);
		smax(ay, Y-d), smin(by, Y+d);
	}
	return ax<=bx && ay<=by;
}

main() {
#ifndef ONLINE_JUDGE
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
#endif

	srand(time(0));

	scanf("%d %d", &n, &k);
	for(int i=1, x, y; i<=n; i++) {
		scanf("%d %d", &x, &y);
		p[i].x={x-y, x+y};
	}
	if(k) {
		for(int i=1, x, y; i<=k; i++) {
			scanf("%d %d", &x, &y);
			::x[i]=x-y, ::y[i]=x+y, id[i]=i;
		}
		build(1, 1, k+1);

		for(int i=1; i<=n; i++) {
			mn=inf;
			X=p[i].x.x, Y=p[i].x.y;
			find(1), calc(1);
			p[i].y=mn;
		}
		sort(p+1, p+n+1, [](pi3 a, pi3 b) {return a.y>b.y;});
	}

	int st=-1, ed=200000000;
	while(ed-st>1) {
		int md=st+ed>>1;
		if(can(md)) ed=md;
		else st=md;
	}
	printf("%d", ed);
}


#include"bits/stdc++.h"
#define inf 0x3f3f3f3f
#define MM 400400
#define NN 100100
#define y second
#define x first

using namespace std;
typedef pair<int, int> pii;
typedef pair<pii, int> pi3;
template<typename A, typename B> inline void smin(A &a, const B &b) {if(a>b) a=b;}
template<typename A, typename B> inline void smax(A &a, const B &b) {if(a<b) a=b;}

int id[NN], LL[MM], RR[MM];
int x[NN], y[NN], xmn[MM], xmx[MM], ymn[MM], ymx[MM];

inline void select(int L, int mid, int R, int *val) {
	R--; int i, j, p, S, X;
	while(L+1<=R) {
		if(L+1==R) {
			if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
			return ;
		}
		S=L+1, X=S+rand()*rand()%(R-L);
		swap(id[L], id[X]);
		if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
		if(val[id[L]]>val[id[S]]) swap(id[L], id[S]);
		if(val[id[S]]>val[id[R]]) swap(id[S], id[R]);
		i=L, j=R, p=val[id[S]];
		while(true) {
			while(i<=R && val[id[i]]<=p) i++;
			while(j>=L && val[id[j]]>=p) j--;
			if(i>j) break; swap(id[i], id[j]);
		}
		if(mid<=j) R=j;
		else if(mid>=i) L=i;
		else break;
	}
}

inline void build(int u, int L, int R, int dp=0) {
	LL[u]=L, RR[u]=R;
	if(L+1==R) {
		xmn[u]=xmx[u]=x[id[L]];
		ymn[u]=ymx[u]=y[id[L]];
		return ;
	}
	int ls=u<<1, rs=ls|1, mid=L+R>>1;

	if(dp) select(L, mid, R, x);
	else select(L, mid, R, y);

	dp^=1;
	build(ls, L, mid, dp);
	build(rs, mid, R, dp);

	xmn[u]=min(xmn[ls], xmn[rs]), xmx[u]=max(xmx[ls], xmx[rs]);
	ymn[u]=min(ymn[ls], ymn[rs]), ymx[u]=max(ymx[ls], ymx[rs]);
}

pi3 p[NN];
int X, Y, mn;

inline void calc(int u) {
	int x_x=0, y_y=0;
	if(X>xmx[u]) x_x=X-xmx[u];
	if(X<xmn[u]) x_x=xmn[u]-X;
	if(Y>ymx[u]) y_y=Y-ymx[u];
	if(Y<ymn[u]) y_y=ymn[u]-Y;
	if(max(x_x, y_y)>=mn) return ;
	int L=LL[u], R=RR[u];
	if(L+1==R) {
		smin(mn, max(abs(X-x[id[L]]), abs(Y-y[id[L]])));
		return ;
	}
	int ls=u<<1;
	calc(ls), calc(ls|1);
}

int n, k, ax, ay, bx, by;

inline bool in(int u) {
	if( bx<xmn[u] || xmx[u]<ax  ||  by<ymn[u] || ymx[u]<ay) return false;
	if(ax<=xmn[u] && xmx[u]<=bx && ay<=ymn[u] && ymx[u]<=by) return true;
	if(LL[u]+1==RR[u]) return false;
	int ls=u<<1;
	if(in(ls)) return true;
	return in(ls|1);
}

inline bool can(int d) {
	ax=ay=-inf, bx=by=inf;
	for(int i=1; i<=n; i++) {
		if(ax<=bx && ay<=by) {
			if(k && p[i].y<=d) {
				int T=d-p[i].y;
				ax-=T, ay-=T, bx+=T, by+=T;
				if(in(1)) return true;
				ax+=T, ay+=T, bx-=T, by-=T;
			}
		}
		else return false;
		X=p[i].x.x, Y=p[i].x.y;
		smax(ax, X-d), smin(bx, X+d);
		smax(ay, Y-d), smin(by, Y+d);
	}
	return ax<=bx && ay<=by;
}

main() {
#ifndef ONLINE_JUDGE
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
#endif

	srand(time(0));

	scanf("%d %d", &n, &k);
	for(int i=1, x, y; i<=n; i++) {
		scanf("%d %d", &x, &y);
		p[i].x={x-y, x+y};
	}
	if(k) {
		for(int i=1, x, y; i<=k; i++) {
			scanf("%d %d", &x, &y);
			::x[i]=x-y, ::y[i]=x+y, id[i]=i;
		}
		build(1, 1, k+1);

		for(int i=1; i<=n; i++) {
			mn=inf;
			X=p[i].x.x, Y=p[i].x.y;
			calc(1);
			p[i].y=mn;
		}
		sort(p+1, p+n+1, [](pi3 a, pi3 b) {return a.y>b.y;});
	}

	int st=-1, ed=200000000;
	while(ed-st>1) {
		int md=st+ed>>1;
		if(can(md)) ed=md;
		else st=md;
	}
	printf("%d", ed);
}


#include<bits/stdc++.h>

#define inf 0x3f3f3f3f

#define pb push_back

#define y second

#define x first

using namespace std;

typedef long long INT;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

template<typename T, typename U> inline void smin(T &a, const U &b) {if(a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, const U &b) {if(a<b) a=b;}

typedef vector<int> VI;

#define NN 100100

#define MM 400400

int id[NN], LL[MM], RR[MM];

int x[NN], y[NN], xmn[MM], xmx[MM], ymn[MM], ymx[MM];

#define sq(_) ((INT)(_)*(_))

//inline bool cmpx(int u, int v) {return x[u]<x[v];}

//inline bool cmpy(int u, int v) {return y[u]<y[v];}

inline INT dist(int u, int v) {return sq(x[u]-x[v])+sq(y[u]-y[v]);}

inline void select(int L, int mid, int R, int* val) {

	R--;

	while(L+1<=R) {

		if(L+1==R) {

			if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);

			return ;

		}

		int S=L+1, X=S+rand()*rand()%(R-L);

		swap(id[L], id[X]);

		if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);

		if(val[id[L]]>val[id[S]]) swap(id[L], id[S]);

		if(val[id[S]]>val[id[R]]) swap(id[S], id[R]);

		int i=L, j=R, p=val[id[S]];

		while(1) {

			while(i<=R && val[id[i]]<=p) i++;

			while(j>=L && val[id[j]]>=p) j--;

			if(i>j) break;

			swap(id[i], id[j]);

		}

		if(mid<=j) R=j;

		else if(mid>=i) L=i;

		else break;

	}

}

inline void build(int u, int L, int R, int dp=0) {

	LL[u]=L, RR[u]=R;

	if(L+1==R) {

		xmn[u]=xmx[u]=x[id[L]];

		ymn[u]=ymx[u]=y[id[L]];

		return ;

	}

	int ls=u<<1, rs=ls|1, mid=L+R>>1;

	if(dp) select(L, mid, R, x);

	else select(L, mid, R, y);

	dp^=1;

	build(ls, L, mid, dp);

	build(rs, mid, R, dp);

	xmn[u]=min(xmn[ls], xmn[rs]), xmx[u]=max(xmx[ls], xmx[rs]);

	ymn[u]=min(ymn[ls], ymn[rs]), ymx[u]=max(ymx[ls], ymx[rs]);

}

int X, Y;

INT mn;

inline int find(int u) {

	int L=LL[u], R=RR[u];

	if(L+1<R) {

		for(int i=L; i<R; i++) {

			int xx=x[id[L]], yy=y[id[L]];

			if(xx!=X && yy!=Y) {

				INT d=sq(xx-X)+sq(yy-Y);

			}

		}

		return 1;

	}

	if(X<xmn[u] || X>xmx[u]) return 0;

	if(Y<ymn[u] || Y>ymx[u]) return 0;

	int ls=u<<1;

	if(find(ls)) return 1;

	return find(ls|1);

}

int ax, ay, bx, by;

inline bool calc(int u) {

	if(xmn[u]>bx || xmx[u]<ax || ymn[u]>by || ymx[u]<ay) return false;

	if(ax<=xmn[u] && xmx[u]<=bx && ay<=ymn[u] && ymx[u]<=by) return true;

	int L=LL[u], R=RR[u];

	if(L+1==R) return false;

	int ls=u<<1;

	if(calc(ls)) return true;

	return calc(ls|1);

}

pi3 p[NN];

int n;

inline bool can(int T) {

	ax=ay=-inf, bx=by=inf;

	for(int i=0; i<n; i++) {

		int x=p[i].x.x, y=p[i].x.y;

		smax(ax, x-T), smin(bx, x+T);

		smax(ay, y-T), smin(by, y+T);

		if(ax<=bx && ay<=by) {

			if(i==n-1) return true;

			int d=p[i].y;

			if(d<=T) {

				d=T-d;

				ax-=d, bx+=d;

				ay-=d, by+=d;

				if(calc(1)) return true;

			}

		}

		else return false;

	}

}

main() {

#ifndef	ONLINE_JUDGE

	freopen("in.in", "r", stdin);

	freopen("out.out", "w", stdout);

#endif

	srand(time(0));

	int m; scanf("%d %d", &n, &m);

	if(n==1) return puts("0");

	for(int i=0, x, y; i<n; i++) {

		scanf("%d %d", &x, &y);

		p[i]=pi3(pii(x-y, x+y), 0);

	}

	for(int i=0, x, y; i<m; i++) {

		::x[i]=x-y;

		::y[i]=x+y;

		id[i]=i;

	}

	if(m) build(1, 0, m);

	for(int i=0, x, y; i<n; i++) {

		x=p[i].x.x, y=p[i].x.y;

		int st=-1, ed=inf;

		while(st+1<ed) {

			int md=st+ed>>1;

			ax=x-md, bx=x+md, ay=y-md, by=y+md;

			if(calc(1)) ed=md;

			else st=md;

		}

		p[i].y=ed;

//		cout<<x<<' '<<y<<' '<<ed<<endl;

	}

	sort(p, p+n, [](pi3 a, pi3 b) {return a.y>b.y;});

	int st=-1, ed=inf;

	while(st+1<ed) {

		int md=st+ed>>1;

		if(can(md)) ed=md;

		else st=md;

	}

	printf("%d", ed);

}


#include"bits/stdc++.h"
#define inf 0x3f3f3f3f
#define MM 400400
#define NN 100100
#define y second
#define x first

using namespace std;
typedef pair<int, int> pii;
typedef pair<pii, int> pi3;
template<typename A, typename B> inline void smin(A &a, const B &b) {if(a>b) a=b;}
template<typename A, typename B> inline void smax(A &a, const B &b) {if(a<b) a=b;}

int id[NN], LL[MM], RR[MM];
int x[NN], y[NN], xmn[MM], xmx[MM], ymn[MM], ymx[MM];

inline void select(int L, int mid, int R, int *val) {
	R--; int i, j, p, S, X;
	while(L+1<=R) {
		if(L+1==R) {
			if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
			return ;
		}
		S=L+1, X=S+rand()*rand()%(R-L);
		swap(id[L], id[X]);
		if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
		if(val[id[L]]>val[id[S]]) swap(id[L], id[S]);
		if(val[id[S]]>val[id[R]]) swap(id[S], id[R]);
		i=L, j=R, p=val[id[S]];
		while(true) {
			while(i<=R && val[id[i]]<=p) i++;
			while(j>=L && val[id[j]]>=p) j--;
			if(i>j) break; swap(id[i], id[j]);
		}
		if(mid<=j) R=j;
		else if(mid>=i) L=i;
		else break;
	}
}

inline void build(int u, int L, int R, int dp=0) {
	LL[u]=L, RR[u]=R;
	if(L+1==R) {
		xmn[u]=xmx[u]=x[id[L]];
		ymn[u]=ymx[u]=y[id[L]];
		return ;
	}
	int ls=u<<1, rs=ls|1, mid=L+R>>1;

	if(dp) select(L, mid, R, x);
	else select(L, mid, R, y);

	dp^=1;
	build(ls, L, mid, dp);
	build(rs, mid, R, dp);

	xmn[u]=min(xmn[ls], xmn[rs]), xmx[u]=max(xmx[ls], xmx[rs]);
	ymn[u]=min(ymn[ls], ymn[rs]), ymx[u]=max(ymx[ls], ymx[rs]);
}

pi3 p[NN];
int X, Y, mn;

inline bool find(int u) {
	int L=LL[u], R=RR[u];
	if(R-L<=4) {
		for(int i=L; i<R; i++) {
			smin(mn, max(abs(X-x[id[i]]), abs(Y-y[id[i]])));
		}
		return true;
	}
	int ls=u<<1;
	if(find(ls)) return true;
	return find(ls|1);
}

inline void calc(int u) {
	int x_x=0, y_y=0;
	if(X>xmx[u]) x_x=X-xmx[u];
	if(X<xmn[u]) x_x=xmn[u]-X;
	if(Y>ymx[u]) y_y=Y-ymx[u];
	if(Y<ymn[u]) y_y=ymn[u]-Y;
	if(max(x_x, y_y)>mn) return ;
	int L=LL[u], R=RR[u];
	if(L+1==R) {
		smin(mn, max(abs(X-x[id[L]]), abs(Y-y[id[L]])));
		return ;
	}
	int ls=u<<1;
	calc(ls), calc(ls|1);
}

int n, k, ax, ay, bx, by;

inline bool in(int u) {
	if( bx<xmn[u] || xmx[u]<ax  ||  by<ymn[u] || ymx[u]<ay) return false;
	if(ax<=xmn[u] && xmx[u]<=bx && ay<=ymn[u] && ymx[u]<=by) return true;
	if(LL[u]+1==RR[u]) return false;
	int ls=u<<1;
	if(in(ls)) return true;
	return in(ls|1);
}

inline bool can(int d) {
	ax=ay=-inf, bx=by=inf;
	for(int i=1; i<=n; i++) {
		if(ax<=bx && ay<=by) {
			if(k && p[i].y<=d) {
				int T=d-p[i].y;
				ax-=T, ay-=T, bx+=T, by+=T;
				if(in(1)) return true;
				ax+=T, ay+=T, bx-=T, by-=T;
			}
		}
		else return false;
		X=p[i].x.x, Y=p[i].x.y;
		smax(ax, X-d), smin(bx, X+d);
		smax(ay, Y-d), smin(by, Y+d);
	}
	return ax<=bx && ay<=by;
}

main() {
	srand(time(0));

	scanf("%d %d", &n, &k);
	for(int i=1, x, y; i<=n; i++) {
		scanf("%d %d", &x, &y);
		p[i].x={x-y, x+y};
	}
	if(k) {
		for(int i=1, x, y; i<=k; i++) {
			scanf("%d %d", &x, &y);
			::x[i]=x-y, ::y[i]=x+y, id[i]=i;
		}
		build(1, 1, k+1);

		for(int i=1; i<=n; i++) {
			mn=inf;
			X=p[i].x.x, Y=p[i].x.y;
			find(1), calc(1);
			p[i].y=mn;
		}
		sort(p+1, p+n+1, [](pi3 a, pi3 b) {return a.y>b.y;});
	}

	int st=-1, ed=200000000;
	while(ed-st>1) {
		int md=st+ed>>1;
		if(can(md)) ed=md;
		else st=md;
	}
	printf("%d", ed);
}


#include<bits/stdc++.h>

#define inf 0x3f3f3f3f

#define pb push_back

#define y second

#define x first

using namespace std;

typedef long long INT;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

template<typename T, typename U> inline void smin(T &a, const U &b) {if(a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, const U &b) {if(a<b) a=b;}

typedef vector<int> VI;

#define NN 100100

#define MM 400400

int id[NN], LL[MM], RR[MM];

int x[NN], y[NN], xmn[MM], xmx[MM], ymn[MM], ymx[MM];

#define sq(_) ((INT)(_)*(_))

//inline bool cmpx(int u, int v) {return x[u]<x[v];}

//inline bool cmpy(int u, int v) {return y[u]<y[v];}

inline INT dist(int u, int v) {return sq(x[u]-x[v])+sq(y[u]-y[v]);}

inline void select(int L, int mid, int R, int* val) {

	R--;

	while(L+1<=R) {

		if(L+1==R) {

			if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);

			return ;

		}

		int S=L+1, X=S+rand()*rand()%(R-L);

		swap(id[L], id[X]);

		if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);

		if(val[id[L]]>val[id[S]]) swap(id[L], id[S]);

		if(val[id[S]]>val[id[R]]) swap(id[S], id[R]);

		int i=L, j=R, p=val[id[S]];

		while(1) {

			while(i<=R && val[id[i]]<=p) i++;

			while(j>=L && val[id[j]]>=p) j--;

			if(i>j) break;

			swap(id[i], id[j]);

		}

		if(mid<=j) R=j;

		else if(mid>=i) L=i;

		else break;

	}

}

inline void build(int u, int L, int R, int dp=0) {

	LL[u]=L, RR[u]=R;

	if(L+1==R) {

		xmn[u]=xmx[u]=x[id[L]];

		ymn[u]=ymx[u]=y[id[L]];

		return ;

	}

	int ls=u<<1, rs=ls|1, mid=L+R>>1;

	if(dp) select(L, mid, R, x);

	else select(L, mid, R, y);

	dp^=1;

	build(ls, L, mid, dp);

	build(rs, mid, R, dp);

	xmn[u]=min(xmn[ls], xmn[rs]), xmx[u]=max(xmx[ls], xmx[rs]);

	ymn[u]=min(ymn[ls], ymn[rs]), ymx[u]=max(ymx[ls], ymx[rs]);

}

int ax, ay, bx, by;

inline bool calc(int u) {

	if(xmn[u]>bx || xmx[u]<ax || ymn[u]>by || ymx[u]<ay) return false;

	if(ax<=xmn[u] && xmx[u]<=bx && ay<=ymn[u] && ymx[u]<=by) return true;

	int L=LL[u], R=RR[u];

	if(L+1==R) return false;

	int ls=u<<1;

	if(calc(ls)) return true;

	return calc(ls|1);

}

pi3 p[NN];

int n, m;

inline bool can(int T) {

	ax=ay=-inf, bx=by=inf;

	for(int i=0; i<n; i++) {

		if(ax<=bx && ay<=by) {

			if(!m) continue;

			int d=p[i].y;

			if(d<=T) {

				d=T-d;

				ax-=d, bx+=d;

				ay-=d, by+=d;

				if(calc(1)) return true;

			}

		}

		else return false;

		int x=p[i].x.x, y=p[i].x.y;

		smax(ax, x-T), smin(bx, x+T);

		smax(ay, y-T), smin(by, y+T);

	}

	return ax<=bx && ay<=by;

}

main() {

#ifndef	ONLINE_JUDGE

	freopen("in.in", "r", stdin);

	freopen("out.out", "w", stdout);

#endif

	srand(time(0));

	scanf("%d %d", &n, &m);

	if(n==1) return puts("0");

	for(int i=0, x, y; i<n; i++) {

		scanf("%d %d", &x, &y);

		p[i]=pi3(pii(x-y, x+y), 0);

	}

	for(int i=0, x, y; i<m; i++) {

		::x[i]=x-y;

		::y[i]=x+y;

		id[i]=i;

	}

	if(m) build(1, 0, m);

	for(int i=0, x, y; i<n; i++) {

		x=p[i].x.x, y=p[i].x.y;

		int st=-1, ed=inf;

		while(st+1<ed) {

			int md=st+ed>>1;

			ax=x-md, bx=x+md, ay=y-md, by=y+md;

			if(m && calc(1)) ed=md;

			else st=md;

		}

		p[i].y=ed;

	}

	sort(p, p+n, [](pi3 a, pi3 b) {return a.y>b.y;});

	int st=-1, ed=inf;

	while(st+1<ed) {

		int md=st+ed>>1;

		if(can(md)) ed=md;

		else st=md;

	}

	printf("%d", ed);

}


#include"bits/stdc++.h"
#define inf 0x3f3f3f3f
#define MM 400400
#define NN 100100
#define y second
#define x first

using namespace std;
typedef pair<int, int> pii;
typedef pair<pii, int> pi3;
template<typename A, typename B> inline void smin(A &a, const B &b) {if(a>b) a=b;}
template<typename A, typename B> inline void smax(A &a, const B &b) {if(a<b) a=b;}

int id[NN], LL[MM], RR[MM];
int x[NN], y[NN], xmn[MM], xmx[MM], ymn[MM], ymx[MM];
int xx[MM], yy[MM];

inline void select(int L, int mid, int R, int *val) {
	R--; int i, j, p, S, X;
	while(L+1<=R) {
		if(L+1==R) {
			if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
			return ;
		}
		S=L+1, X=S+rand()*rand()%(R-L);
		swap(id[L], id[X]);
		if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
		if(val[id[L]]>val[id[S]]) swap(id[L], id[S]);
		if(val[id[S]]>val[id[R]]) swap(id[S], id[R]);
		i=L, j=R, p=val[id[S]];
		while(true) {
			while(i<=R && val[id[i]]<=p) i++;
			while(j>=L && val[id[j]]>=p) j--;
			if(i>j) break; swap(id[i], id[j]);
		}
		if(mid<=j) R=j;
		else if(mid>=i) L=i;
		else break;
	}
}

inline void build(int u, int L, int R, int dp=0) {
	LL[u]=L, RR[u]=R;
	if(L+1==R) {
		xmn[u]=xmx[u]=xx[u]=x[id[L]];
		ymn[u]=ymx[u]=yy[u]=y[id[L]];
		return ;
	}
	int ls=u<<1, rs=ls|1, mid=L+R>>1;

	if(dp) select(L, mid, R, x);
	else select(L, mid, R, y);

	dp^=1;
	build(ls, L, mid, dp);
	build(rs, mid, R, dp);

	xmn[u]=min(xmn[ls], xmn[rs]), xmx[u]=max(xmx[ls], xmx[rs]);
	ymn[u]=min(ymn[ls], ymn[rs]), ymx[u]=max(ymx[ls], ymx[rs]);

	if(rand()&1) xx[u]=xx[ls], yy[u]=yy[ls];
	else xx[u]=xx[rs], yy[u]=yy[rs];
}

pi3 p[NN];
int X, Y, mn;

inline void calc(int u) {
	smin(mn, max(abs(X-xx[u]), abs(Y-yy[u])));
	int x_x=0, y_y=0;
	if(X>xmx[u]) x_x=X-xmx[u];
	if(X<xmn[u]) x_x=xmn[u]-X;
	if(Y>ymx[u]) y_y=Y-ymx[u];
	if(Y<ymn[u]) y_y=ymn[u]-Y;
	if(max(x_x, y_y)>=mn) return ;
	int L=LL[u], R=RR[u];
	if(L+1==R) {
		smin(mn, max(abs(X-x[id[L]]), abs(Y-y[id[L]])));
		return ;
	}

	int ls=u<<1;
	calc(ls), calc(ls|1);
}

int n, k, ax, ay, bx, by;

inline bool in(int u) {
	if( bx<xmn[u] || xmx[u]<ax  ||  by<ymn[u] || ymx[u]<ay) return false;
	if(ax<=xmn[u] && xmx[u]<=bx && ay<=ymn[u] && ymx[u]<=by) return true;
	if(LL[u]+1==RR[u]) return false;
	int ls=u<<1;
	if(in(ls)) return true;
	return in(ls|1);
}

inline bool can(int d) {
	ax=ay=-inf, bx=by=inf;
	for(int i=1; i<=n; i++) {
		if(ax<=bx && ay<=by) {
			if(k && p[i].y<=d) {
				int T=d-p[i].y;
				ax-=T, ay-=T, bx+=T, by+=T;
				if(in(1)) return true;
				ax+=T, ay+=T, bx-=T, by-=T;
			}
		}
		else return false;
		X=p[i].x.x, Y=p[i].x.y;
		smax(ax, X-d), smin(bx, X+d);
		smax(ay, Y-d), smin(by, Y+d);
	}
	return ax<=bx && ay<=by;
}

main() {
#ifndef ONLINE_JUDGE
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
#endif

	srand(time(0));

	scanf("%d %d", &n, &k);
	for(int i=1, x, y; i<=n; i++) {
		scanf("%d %d", &x, &y);
		p[i].x={x-y, x+y};
	}
	if(k) {
		for(int i=1, x, y; i<=k; i++) {
			scanf("%d %d", &x, &y);
			::x[i]=x-y, ::y[i]=x+y, id[i]=i;
		}
		build(1, 1, k+1);

		for(int i=1; i<=n; i++) {
			mn=inf;
			X=p[i].x.x, Y=p[i].x.y;
			calc(1);
			p[i].y=mn;
		}
		sort(p+1, p+n+1, [](pi3 a, pi3 b) {return a.y>b.y;});
	}

	int st=-1, ed=200000000;
	while(ed-st>1) {
		int md=st+ed>>1;
		if(can(md)) ed=md;
		else st=md;
	}
	printf("%d", ed);
}


#include<bits/stdc++.h>

#define INPUT_LEN 1000

#define inf 200000000

#define NN 100001

#define MM 400000

#define y second

#define x first

using namespace std;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

template<typename T, typename U> inline void smin(T &a, const U &b) {if(a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, const U &b) {if(a<b) a=b;}

char gchar(){static char tbuf1[INPUT_LEN],*tmp_st=tbuf1,*tmp_ed=tbuf1;if(tmp_st==tmp_ed){int len=fread(tbuf1,1,INPUT_LEN,stdin);if(len==0)return-1;tmp_ed=tbuf1+len;tmp_st=tbuf1;}return*(tmp_st++);}

inline bool gn(int&x){char c,sg=0;while(c=gchar(),(c>'9'||c<'0')&&c!='-'&&~c);if(c==-1)return 0;for((c=='-'?sg=1,c=gchar():0),x=0;c>='0'&&c<='9';c=gchar())x=(x<<1)+(x<<3)+c-'0';if(sg)x=-x;return 1;}

inline void print(int x){if(x<0){putchar('-');return print(-x);}if(x<10){putchar('0'+x);return;}print(x/10);putchar(x%10+'0');}

int id[NN], LL[MM], RR[MM];

int x[NN], y[NN], xmn[MM], xmx[MM], ymn[MM], ymx[MM];

inline void select(int L, int mid, int R, int* val) {

	R--;

	while(L+1<=R) {

		if(L+1==R) {

			if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);

			return ;

		}

		int S=L+1, X=S+rand()*rand()%(R-L);

		swap(id[L], id[X]);

		if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);

		if(val[id[L]]>val[id[S]]) swap(id[L], id[S]);

		if(val[id[S]]>val[id[R]]) swap(id[S], id[R]);

		int i=L, j=R, p=val[id[S]];

		while(1) {

			while(i<=R && val[id[i]]<=p) i++;

			while(j>=L && val[id[j]]>=p) j--;

			if(i>j) break;

			swap(id[i], id[j]);

		}

		if(mid<=j) R=j;

		else if(mid>=i) L=i;

		else break;

	}

}

inline void build(int u, int L, int R, int dp=0) {

	LL[u]=L, RR[u]=R;

	if(L+1==R) {

		xmn[u]=xmx[u]=x[id[L]];

		ymn[u]=ymx[u]=y[id[L]];

		return ;

	}

	int ls=u<<1, rs=ls|1, mid=L+R>>1;

	if(dp) select(L, mid, R, x);

	else select(L, mid, R, y);

	dp^=1;

	build(ls, L, mid, dp);

	build(rs, mid, R, dp);

	xmn[u]=min(xmn[ls], xmn[rs]), xmx[u]=max(xmx[ls], xmx[rs]);

	ymn[u]=min(ymn[ls], ymn[rs]), ymx[u]=max(ymx[ls], ymx[rs]);

}

int ax, ay, bx, by;

inline bool calc(int u) {

	if(xmn[u]>bx || xmx[u]<ax || ymn[u]>by || ymx[u]<ay) return false;

	if(ax<=xmn[u] && xmx[u]<=bx && ay<=ymn[u] && ymx[u]<=by) return true;

	if(LL[u]+1==RR[u]) return false;

	int ls=u<<1;

	if(calc(ls)) return true;

	return calc(ls|1);

}

pi3 p[NN];

int n, m;

inline bool can(int T) {

	ax=ay=-inf, bx=by=inf;

	for(int i=0; i<n; i++) {

		if(ax<=bx && ay<=by) {

			if(m && p[i].y<=T) {

				int d=T-p[i].y;

				ax-=d, bx+=d, ay-=d, by+=d;

				if(calc(1)) return true;

				ax+=d, bx-=d, ay+=d, by-=d;

			}

		}

		else return false;

		int x=p[i].x.x, y=p[i].x.y;

		smax(ax, x-T), smin(bx, x+T);

		smax(ay, y-T), smin(by, y+T);

	}

	return ax<=bx && ay<=by;

}

main() {

#ifndef	ONLINE_JUDGE

	freopen("in.in", "r", stdin);

	freopen("out.out", "w", stdout);

#endif

	srand(time(0));

	gn(n), gn(m);

	if(n==1) return puts("0");

	for(int i=0, x, y; i<n; i++) {

		gn(x), gn(y);

		p[i]=pi3(pii(x-y, x+y), 0);

	}

	for(int i=0, x, y; i<m; i++) {

		gn(x), gn(y);

		::x[i]=x-y;

		::y[i]=x+y;

		id[i]=i;

	}

	if(m) build(1, 0, m);

	for(int i=0, x, y; i<n; i++) {

		x=p[i].x.x, y=p[i].x.y;

		int st=-1, ed=inf;

		while(st+1<ed) {

			int md=st+ed>>1;

			ax=x-md, bx=x+md, ay=y-md, by=y+md;

			if(m && calc(1)) ed=md;

			else st=md;

		}

		p[i].y=ed;

	}

	sort(p, p+n, [](pi3 a, pi3 b) {return a.y>b.y;});

	int st=-1, ed=inf;

	while(st+1<ed) {

		int md=st+ed>>1;

		if(can(md)) ed=md;

		else st=md;

	}

	print(ed);

}


#include"bits/stdc++.h"
#define inf 0x3f3f3f3f
#define MM 400400
#define NN 100100
#define y second
#define x first

using namespace std;
typedef pair<int, int> pii;
typedef pair<pii, int> pi3;
template<typename A, typename B> inline void smin(A &a, const B &b) {if(a>b) a=b;}
template<typename A, typename B> inline void smax(A &a, const B &b) {if(a<b) a=b;}
int id[NN], LL[MM], RR[MM];
int x[NN], y[NN], xmn[MM], xmx[MM], ymn[MM], ymx[MM];

inline void select(int L, int mid, int R, int *val) {
	R--; int i, j, p, S, X;
	while(L+1<=R) {
		if(L+1==R) {
			if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
			return ;
		}
		S=L+1, X=S+rand()*rand()%(R-L);
		swap(id[L], id[X]);
		if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
		if(val[id[L]]>val[id[S]]) swap(id[L], id[S]);
		if(val[id[S]]>val[id[R]]) swap(id[S], id[R]);
		i=L, j=R, p=val[id[S]];
		while(true) {
			while(i<=R && val[id[i]]<=p) i++;
			while(j>=L && val[id[j]]>=p) j--;
			if(i>j) break; swap(id[i], id[j]);
		}
		if(mid<=j) R=j;
		else if(mid>=i) L=i;
		else break;
	}
}

inline void build(int u, int L, int R, int dp=0) {
	LL[u]=L, RR[u]=R;
	if(L+1==R) {
		xmn[u]=xmx[u]=x[id[L]];
		ymn[u]=ymx[u]=y[id[L]];
		return ;
	}
	int ls=u<<1, rs=ls|1, mid=L+R>>1;

	if(dp) select(L, mid, R, x);
	else select(L, mid, R, y);

	dp^=1;
	build(ls, L, mid, dp);
	build(rs, mid, R, dp);

	xmn[u]=min(xmn[ls], xmn[rs]), xmx[u]=max(xmx[ls], xmx[rs]);
	ymn[u]=min(ymn[ls], ymn[rs]), ymx[u]=max(ymx[ls], ymx[rs]);
}

pi3 p[NN];
int X, Y, mn;

inline bool find(int u) {
	int L=LL[u], R=RR[u];
	if(R-L<=4) {
		for(int i=L; i<R; i++) {
			smin(mn, max(abs(X-x[id[i]]), abs(Y-y[id[i]])));
		}
		return true;
	}
	int ls=u<<1;
	if(!find(ls)) return find(ls|1);
	return true;
}

inline void calc(int u) {
	int x_x=0, y_y=0;
	if(X>xmx[u]) x_x=X-xmx[u];
	if(X<xmn[u]) x_x=xmn[u]-X;
	if(Y>ymx[u]) y_y=Y-ymx[u];
	if(Y<ymn[u]) y_y=ymn[u]-Y;
	if(max(x_x, y_y)>mn) return ;
	int L=LL[u], R=RR[u];
	if(L+1==R) {
		smin(mn, max(abs(X-x[id[L]]), abs(Y-y[id[L]])));
		return ;
	}
	int ls=u<<1;
	calc(ls), calc(ls|1);
}

int n, k, ax, ay, bx, by;

inline bool in(int u) {
	if(xmx[u]<ax || bx<xmn[u]) return false;
	if(ymx[u]<ay || by<ymn[u]) return false;
	if(xmn[u]<=ax && bx<=xmx[u] && ymn[u]<=ay && by<=ymx[u]) return true;
	if(LL[u]+1==RR[u]) return false;
	int ls=u<<1;
	if(!in(ls)) return in(ls|1);
	return true;
}

inline bool can(int d) {
	int Xmn=-inf, Ymn=-inf, Xmx=inf, Ymx=inf, id=1;
	for(; id<=n && p[id].y>d; id++) {
		smax(Xmn, p[id].x.x-d); smin(Xmx, p[id].x.x+d);
		smax(Ymn, p[id].x.y-d); smin(Ymx, p[id].x.y+d);
		if(Xmn>Xmx || Ymn>Ymx) return false;
	}

	for(; id<=n; id++) {
		int len=d-p[id+1].y;
		ax=Xmn-len, ay=Ymn-len, bx=Xmx+len, by=Ymx+len;
		if(k && in(1)) return true;
		smax(Xmn, p[id].x.x-d); smin(Xmx, p[id].x.x+d);
		smax(Ymn, p[id].x.y-d); smin(Ymx, p[id].x.y+d);
		if(Xmn>Xmx || Ymn>Ymx) return false;
	}
	return true;
}

main() {
	srand(time(0));
	scanf("%d %d", &n, &k);
	for(int i=1, x, y; i<=n; i++) {
		scanf("%d %d", &x, &y);
		p[i].x={x-y, x+y};
	}
	if(k) {
		for(int i=1, x, y; i<=k; i++) {
			scanf("%d %d", &x, &y);
			::x[i]=x-y, ::y[i]=x+y;
			id[i]=i;
		}
		build(1, 1, k+1);
		for(int i=1; i<=n; i++) {
			mn=inf;
			X=p[i].x.x, Y=p[i].x.y;
			find(1), calc(1);
			p[i].y=mn;
		}
		sort(p+1, p+n+1, [](pi3 a, pi3 b) {return a.y>b.y;});
	}

	int st=-1, ed=200000000;
	while(ed-st>1) {
		int md=st+ed>>1;
		if(can(md)) ed=md;
		else st=md;
	}
	printf("%d", ed);
}


#include"bits/stdc++.h"
#define inf 0x3f3f3f3f
#define MM 400400
#define NN 100100
#define y second
#define x first

using namespace std;
typedef pair<int, int> pii;
typedef pair<pii, int> pi3;
template<typename A, typename B> inline void smin(A &a, const B &b) {if(a>b) a=b;}
template<typename A, typename B> inline void smax(A &a, const B &b) {if(a<b) a=b;}

int id[NN], LL[MM], RR[MM];
int x[NN], y[NN], xmn[MM], xmx[MM], ymn[MM], ymx[MM];

inline void select(int L, int mid, int R, int *val) {
	R--; int i, j, p, S, X;
	while(L+1<=R) {
		if(L+1==R) {
			if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
			return ;
		}
		S=L+1, X=S+rand()*rand()%(R-L);
		swap(id[L], id[X]);
		if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
		if(val[id[L]]>val[id[S]]) swap(id[L], id[S]);
		if(val[id[S]]>val[id[R]]) swap(id[S], id[R]);
		i=L, j=R, p=val[id[S]];
		while(true) {
			while(i<=R && val[id[i]]<=p) i++;
			while(j>=L && val[id[j]]>=p) j--;
			if(i>j) break; swap(id[i], id[j]);
		}
		if(mid<=j) R=j;
		else if(mid>=i) L=i;
		else break;
	}
}

inline void build(int u, int L, int R, int dp=0) {
	LL[u]=L, RR[u]=R;
	if(L+1==R) {
		xmn[u]=xmx[u]=x[id[L]];
		ymn[u]=ymx[u]=y[id[L]];
		return ;
	}
	int ls=u<<1, rs=ls|1, mid=L+R>>1;

	if(dp) select(L, mid, R, x);
	else select(L, mid, R, y);

	dp^=1;
	build(ls, L, mid, dp);
	build(rs, mid, R, dp);

	xmn[u]=min(xmn[ls], xmn[rs]), xmx[u]=max(xmx[ls], xmx[rs]);
	ymn[u]=min(ymn[ls], ymn[rs]), ymx[u]=max(ymx[ls], ymx[rs]);
}

pi3 p[NN];
int X, Y, mn;

inline bool find(int u) {
	int L=LL[u], R=RR[u];
	if(R-L<=7) {
		for(int i=L; i<R; i++) {
			smin(mn, max(abs(X-x[id[i]]), abs(Y-y[id[i]])));
		}
		return true;
	}
	int ls=u<<1;
	if(find(ls)) return true;
	return find(ls|1);
}

inline void calc(int u) {
	int x_x=0, y_y=0;
	if(X>xmx[u]) x_x=X-xmx[u];
	if(X<xmn[u]) x_x=xmn[u]-X;
	if(Y>ymx[u]) y_y=Y-ymx[u];
	if(Y<ymn[u]) y_y=ymn[u]-Y;
	if(max(x_x, y_y)>mn) return ;
	int L=LL[u], R=RR[u];
	if(L+1==R) {
		smin(mn, max(abs(X-x[id[L]]), abs(Y-y[id[L]])));
		return ;
	}
	int ls=u<<1;
	calc(ls), calc(ls|1);
}

int n, k, ax, ay, bx, by;

inline bool in(int u) {
	if( bx<xmn[u] || xmx[u]<ax  ||  by<ymn[u] || ymx[u]<ay) return false;
	if(ax<=xmn[u] && xmx[u]<=bx && ay<=ymn[u] && ymx[u]<=by) return true;
	if(LL[u]+1==RR[u]) return false;
	int ls=u<<1;
	if(in(ls)) return true;
	return in(ls|1);
}

inline bool can(int d) {
	ax=ay=-inf, bx=by=inf;
	for(int i=1; i<=n; i++) {
		if(ax<=bx && ay<=by) {
			if(k && p[i].y<=d) {
				int T=d-p[i].y;
				ax-=T, ay-=T, bx+=T, by+=T;
				if(in(1)) return true;
				ax+=T, ay+=T, bx-=T, by-=T;
			}
		}
		else return false;
		X=p[i].x.x, Y=p[i].x.y;
		smax(ax, X-d), smin(bx, X+d);
		smax(ay, Y-d), smin(by, Y+d);
	}
	return ax<=bx && ay<=by;
}

main() {
#ifndef ONLINE_JUDGE
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
#endif

	srand(time(0));

	scanf("%d %d", &n, &k);
	for(int i=1, x, y; i<=n; i++) {
		scanf("%d %d", &x, &y);
		p[i].x={x-y, x+y};
	}
	if(k) {
		for(int i=1, x, y; i<=k; i++) {
			scanf("%d %d", &x, &y);
			::x[i]=x-y, ::y[i]=x+y, id[i]=i;
		}
		build(1, 1, k+1);

		for(int i=1; i<=n; i++) {
			mn=inf;
			X=p[i].x.x, Y=p[i].x.y;
			find(1), calc(1);
			p[i].y=mn;
		}
		sort(p+1, p+n+1, [](pi3 a, pi3 b) {return a.y>b.y;});
	}

	int st=-1, ed=200000000;
	while(ed-st>1) {
		int md=st+ed>>1;
		if(can(md)) ed=md;
		else st=md;
	}
	printf("%d", ed);
}


#include"bits/stdc++.h"
#define inf 0x3f3f3f3f
#define MM 400400
#define NN 100100
#define y second
#define x first

using namespace std;
typedef pair<int, int> pii;
typedef pair<pii, int> pi3;
template<typename A, typename B> inline void smin(A &a, const B &b) {if(a>b) a=b;}
template<typename A, typename B> inline void smax(A &a, const B &b) {if(a<b) a=b;}

int id[NN], LL[MM], RR[MM];
int x[NN], y[NN], xmn[MM], xmx[MM], ymn[MM], ymx[MM];

inline void select(int L, int mid, int R, int *val) {
	R--; int i, j, p, S, X;
	while(L+1<=R) {
		if(L+1==R) {
			if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
			return ;
		}
		S=L+1, X=S+rand()*rand()%(R-L);
		swap(id[L], id[X]);
		if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
		if(val[id[L]]>val[id[S]]) swap(id[L], id[S]);
		if(val[id[S]]>val[id[R]]) swap(id[S], id[R]);
		i=L, j=R, p=val[id[S]];
		while(true) {
			while(i<=R && val[id[i]]<=p) i++;
			while(j>=L && val[id[j]]>=p) j--;
			if(i>j) break; swap(id[i], id[j]);
		}
		if(mid<=j) R=j;
		else if(mid>=i) L=i;
		else break;
	}
}

inline void build(int u, int L, int R, int dp=0) {
	LL[u]=L, RR[u]=R;
	if(L+1==R) {
		xmn[u]=xmx[u]=x[id[L]];
		ymn[u]=ymx[u]=y[id[L]];
		return ;
	}
	int ls=u<<1, rs=ls|1, mid=L+R>>1;

	if(dp) select(L, mid, R, x);
	else select(L, mid, R, y);

	dp^=1;
	build(ls, L, mid, dp);
	build(rs, mid, R, dp);

	xmn[u]=min(xmn[ls], xmn[rs]), xmx[u]=max(xmx[ls], xmx[rs]);
	ymn[u]=min(ymn[ls], ymn[rs]), ymx[u]=max(ymx[ls], ymx[rs]);
}

pi3 p[NN];
int X, Y, mn;

inline bool find(int u) {
	int L=LL[u], R=RR[u];
	if(R-L<=2) {
		for(int i=L; i<R; i++) {
			smin(mn, max(abs(X-x[id[i]]), abs(Y-y[id[i]])));
		}
		return true;
	}
	int ls=u<<1;
	if(find(ls)) return true;
	return find(ls|1);
}

inline void calc(int u) {
	int x_x=0, y_y=0;
	if(X>xmx[u]) x_x=X-xmx[u];
	if(X<xmn[u]) x_x=xmn[u]-X;
	if(Y>ymx[u]) y_y=Y-ymx[u];
	if(Y<ymn[u]) y_y=ymn[u]-Y;
	if(max(x_x, y_y)>mn) return ;
	int L=LL[u], R=RR[u];
	if(L+1==R) {
		smin(mn, max(abs(X-x[id[L]]), abs(Y-y[id[L]])));
		return ;
	}
	int ls=u<<1;
	calc(ls), calc(ls|1);
}

int n, k, ax, ay, bx, by;

inline bool in(int u) {
	if( bx<xmn[u] || xmx[u]<ax  ||  by<ymn[u] || ymx[u]<ay) return false;
	if(ax<=xmn[u] && xmx[u]<=bx && ay<=ymn[u] && ymx[u]<=by) return true;
	if(LL[u]+1==RR[u]) return false;
	int ls=u<<1;
	if(in(ls)) return true;
	return in(ls|1);
}

inline bool can(int d) {
	ax=ay=-inf, bx=by=inf;
	for(int i=1; i<=n; i++) {
		if(ax<=bx && ay<=by) {
			if(k && p[i].y<=d) {
				int T=d-p[i].y;
				ax-=T, ay-=T, bx+=T, by+=T;
				if(in(1)) return true;
				ax+=T, ay+=T, bx-=T, by-=T;
			}
		}
		else return false;
		X=p[i].x.x, Y=p[i].x.y;
		smax(ax, X-d), smin(bx, X+d);
		smax(ay, Y-d), smin(by, Y+d);
	}
	return ax<=bx && ay<=by;
}

main() {
#ifndef ONLINE_JUDGE
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
#endif

	srand(time(0));

	scanf("%d %d", &n, &k);
	for(int i=1, x, y; i<=n; i++) {
		scanf("%d %d", &x, &y);
		p[i].x={x-y, x+y};
	}
	if(k) {
		for(int i=1, x, y; i<=k; i++) {
			scanf("%d %d", &x, &y);
			::x[i]=x-y, ::y[i]=x+y, id[i]=i;
		}
		build(1, 1, k+1);

		for(int i=1; i<=n; i++) {
			mn=inf;
			X=p[i].x.x, Y=p[i].x.y;
			calc(1);
//			find(1), calc(1);
			p[i].y=mn;
		}
		sort(p+1, p+n+1, [](pi3 a, pi3 b) {return a.y>b.y;});
	}

	int st=-1, ed=200000000;
	while(ed-st>1) {
		int md=st+ed>>1;
		if(can(md)) ed=md;
		else st=md;
	}
	printf("%d", ed);
}


#include"bits/stdc++.h"
#define inf 0x3f3f3f3f
#define MM 400400
#define NN 100100
#define y second
#define x first

using namespace std;
typedef pair<int, int> pii;
typedef pair<pii, int> pi3;
template<typename A, typename B> inline void smin(A &a, const B &b) {if(a>b) a=b;}
template<typename A, typename B> inline void smax(A &a, const B &b) {if(a<b) a=b;}

int id[NN], LL[MM], RR[MM];
int x[NN], y[NN], xmn[MM], xmx[MM], ymn[MM], ymx[MM];

inline void select(int L, int mid, int R, int *val) {
	R--; int i, j, p, S, X;
	while(L+1<=R) {
		if(L+1==R) {
			if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
			return ;
		}
		S=L+1, X=S+rand()*rand()%(R-L);
		swap(id[L], id[X]);
		if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
		if(val[id[L]]>val[id[S]]) swap(id[L], id[S]);
		if(val[id[S]]>val[id[R]]) swap(id[S], id[R]);
		i=L, j=R, p=val[id[S]];
		while(true) {
			while(i<=R && val[id[i]]<=p) i++;
			while(j>=L && val[id[j]]>=p) j--;
			if(i>j) break; swap(id[i], id[j]);
		}
		if(mid<=j) R=j;
		else if(mid>=i) L=i;
		else break;
	}
}

inline void build(int u, int L, int R, int dp=0) {
	LL[u]=L, RR[u]=R;
	if(L+1==R) {
		xmn[u]=xmx[u]=x[id[L]];
		ymn[u]=ymx[u]=y[id[L]];
		return ;
	}
	int ls=u<<1, rs=ls|1, mid=L+R>>1;

	if(dp) select(L, mid, R, x);
	else select(L, mid, R, y);

	dp^=1;
	build(ls, L, mid, dp);
	build(rs, mid, R, dp);

	xmn[u]=min(xmn[ls], xmn[rs]), xmx[u]=max(xmx[ls], xmx[rs]);
	ymn[u]=min(ymn[ls], ymn[rs]), ymx[u]=max(ymx[ls], ymx[rs]);
}

pi3 p[NN];
int X, Y, mn;

inline void calc(int u, int dp=0) {
	int x_x=0, y_y=0;
	if(X>xmx[u]) x_x=X-xmx[u];
	if(X<xmn[u]) x_x=xmn[u]-X;
	if(Y>ymx[u]) y_y=Y-ymx[u];
	if(Y<ymn[u]) y_y=ymn[u]-Y;
	if(max(x_x, y_y)>mn) return ;
	int L=LL[u], R=RR[u];
	if(L+1==R) {
		smin(mn, max(abs(X-x[id[L]]), abs(Y-y[id[L]])));
		return ;
	}
	int ls=u<<1, rs=ls|1;

	dp^=1;
	if(dp) {
		if(Y>=ymn[rs]) calc(rs, dp);
		else if(Y<=ymx[ls]) calc(ls, dp);
		else calc(ls, dp), calc(rs, dp);
	}
	else {
		if(X>=xmn[rs]) calc(rs, dp);
		else if(X<=xmx[ls]) calc(ls, dp);
		else calc(ls, dp), calc(rs, dp);
	}
}

int n, k, ax, ay, bx, by;

inline bool in(int u) {
	if( bx<xmn[u] || xmx[u]<ax  ||  by<ymn[u] || ymx[u]<ay) return false;
	if(ax<=xmn[u] && xmx[u]<=bx && ay<=ymn[u] && ymx[u]<=by) return true;
	if(LL[u]+1==RR[u]) return false;
	int ls=u<<1;
	if(in(ls)) return true;
	return in(ls|1);
}

inline bool can(int d) {
	ax=ay=-inf, bx=by=inf;
	for(int i=1; i<=n; i++) {
		if(ax<=bx && ay<=by) {
			if(k && p[i].y<=d) {
				int T=d-p[i].y;
				ax-=T, ay-=T, bx+=T, by+=T;
				if(in(1)) return true;
				ax+=T, ay+=T, bx-=T, by-=T;
			}
		}
		else return false;
		X=p[i].x.x, Y=p[i].x.y;
		smax(ax, X-d), smin(bx, X+d);
		smax(ay, Y-d), smin(by, Y+d);
	}
	return ax<=bx && ay<=by;
}

main() {
#ifndef ONLINE_JUDGE
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
#endif

	srand(time(0));

	scanf("%d %d", &n, &k);
	for(int i=1, x, y; i<=n; i++) {
		scanf("%d %d", &x, &y);
		p[i].x={x-y, x+y};
	}
	if(k) {
		for(int i=1, x, y; i<=k; i++) {
			scanf("%d %d", &x, &y);
			::x[i]=x-y, ::y[i]=x+y, id[i]=i;
		}
		build(1, 1, k+1);

		for(int i=1; i<=n; i++) {
			mn=inf;
			X=p[i].x.x, Y=p[i].x.y;
			calc(1);
			p[i].y=mn;
		}
		sort(p+1, p+n+1, [](pi3 a, pi3 b) {return a.y>b.y;});
	}

	int st=-1, ed=200000000;
	while(ed-st>1) {
		int md=st+ed>>1;
		if(can(md)) ed=md;
		else st=md;
	}
	printf("%d", ed);
}


#include"bits/stdc++.h"
#define inf 0x3f3f3f3f
#define MM 800400
#define NN 200100
#define y second
#define x first

using namespace std;
typedef pair<int, int> pii;
typedef pair<pii, int> pi3;
template<typename A, typename B> inline void smin(A &a, const B &b) {if(a>b) a=b;}
template<typename A, typename B> inline void smax(A &a, const B &b) {if(a<b) a=b;}

int id[NN], LL[MM], RR[MM];
int x[NN], y[NN], xmn[MM], xmx[MM], ymn[MM], ymx[MM];

inline void select(int L, int mid, int R, int *val) {
	R--; int i, j, p, S, X;
	while(L+1<=R) {
		if(L+1==R) {
			if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
			return ;
		}
		S=L+1, X=S+rand()*rand()%(R-L);
		swap(id[L], id[X]);
		if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
		if(val[id[L]]>val[id[S]]) swap(id[L], id[S]);
		if(val[id[S]]>val[id[R]]) swap(id[S], id[R]);
		i=L, j=R, p=val[id[S]];
		while(true) {
			while(i<=R && val[id[i]]<=p) i++;
			while(j>=L && val[id[j]]>=p) j--;
			if(i>j) break; swap(id[i], id[j]);
		}
		if(mid<=j) R=j;
		else if(mid>=i) L=i;
		else break;
	}
}

inline void build(int u, int L, int R, int dp=0) {
	LL[u]=L, RR[u]=R;
	if(L+1==R) {
		xmn[u]=xmx[u]=x[id[L]];
		ymn[u]=ymx[u]=y[id[L]];
		return ;
	}
	int ls=u<<1, rs=ls|1, mid=L+R>>1;

	if(dp) select(L, mid, R, x);
	else select(L, mid, R, y);

	dp^=1;
	build(ls, L, mid, dp);
	build(rs, mid, R, dp);

	xmn[u]=min(xmn[ls], xmn[rs]), xmx[u]=max(xmx[ls], xmx[rs]);
	ymn[u]=min(ymn[ls], ymn[rs]), ymx[u]=max(ymx[ls], ymx[rs]);
}

pi3 p[NN];
int X, Y, I, mn;

inline bool find(int u) {
	int L=LL[u], R=RR[u];
	if(R-L<=4) {
		for(int i=L; i<R; i++) if(id[i]!=I) {
			smin(mn, max(abs(X-x[id[i]]), abs(Y-y[id[i]])));
		}
		return true;
	}
	int ls=u<<1;
	if(find(ls)) return true;
	return find(ls|1);
}

inline void calc(int u) {
	int x_x=0, y_y=0;
	if(X>xmx[u]) x_x=X-xmx[u];
	if(X<xmn[u]) x_x=xmn[u]-X;
	if(Y>ymx[u]) y_y=Y-ymx[u];
	if(Y<ymn[u]) y_y=ymn[u]-Y;
	if(max(x_x, y_y)>mn) return ;
	int L=LL[u], R=RR[u];
	if(L+1==R) {
		if(id[L]!=I) smin(mn, max(abs(X-x[id[L]]), abs(Y-y[id[L]])));
		return ;
	}
	int ls=u<<1;
	calc(ls), calc(ls|1);
}

int n, k, ax, ay, bx, by;
inline bool in(int u) {
	if( bx<xmn[u] || xmx[u]<ax  ||  by<ymn[u] || ymx[u]<ay) return false;
	if(ax<=xmn[u] && xmx[u]<=bx && ay<=ymn[u] && ymx[u]<=by) return true;
	if(LL[u]+1==RR[u]) return false;
	int ls=u<<1;
	if(in(ls)) return true;
	return in(ls|1);
}

inline bool can(int d) {
	ax=ay=-inf, bx=by=inf;
	for(int i=1; i<=n; i++) {
		if(ax<=bx && ay<=by) {
			if(k && p[i].y<=d) {
				int T=d-p[i].y;
				ax-=T, ay-=T, bx+=T, by+=T;
				if(in(1)) return true;
				ax+=T, ay+=T, bx-=T, by-=T;
			}
		}
		else return false;
		X=p[i].x.x, Y=p[i].x.y;
		smax(ax, X-d), smin(bx, X+d);
		smax(ay, Y-d), smin(by, Y+d);
	}
	return ax<=bx && ay<=by;
}

main() {
	srand(time(0));

	scanf("%d %d", &n, &k);
	for(int i=1, x, y; i<=n; i++) {
		scanf("%d %d", &x, &y);
		p[i].x={x-y, x+y};
	}
	if(k) {
		for(int i=1, x, y; i<=k; i++) {
			scanf("%d %d", &x, &y);
			::x[i]=x-y, ::y[i]=x+y, id[i]=i;
		}
		for(int i=1, u; i<=n; i++) {
			u=i+k;
			x[u]=p[i].x.x, y[u]=p[i].x.y, id[u]=u;
		}
		build(1, 1, k+n+1);

		for(int i=1; i<=n; i++) {
			mn=inf, I=k+i;
			X=p[i].x.x, Y=p[i].x.y;
			find(1), calc(1);
			p[i].y=mn;
		}
		sort(p+1, p+n+1, [](pi3 a, pi3 b) {return a.y>b.y;});
	}

	if(k) {
		for(int i=1; i<=k; i++) id[i]=i;
		build(1, 1, k+1);
	}
	int st=-1, ed=200000000;
	while(ed-st>1) {
		int md=st+ed>>1;
		if(can(md)) ed=md;
		else st=md;
	}
	printf("%d", ed);
}


#include<bits/stdc++.h>

#define inf 300000000

#define y second

#define x first

using namespace std;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

template<typename T, typename U> inline void smin(T &a, const U &b) {if(a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, const U &b) {if(a<b) a=b;}

#define NN 100100

#define MM 400400

int id[NN], LL[MM], RR[MM];

int x[NN], y[NN], xmn[MM], xmx[MM], ymn[MM], ymx[MM];

inline void select(int L, int mid, int R, int* val) {

	R--;

	while(L+1<=R) {

		if(L+1==R) {

			if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);

			return ;

		}

		int S=L+1, X=S+rand()*rand()%(R-L);

		swap(id[L], id[X]);

		if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);

		if(val[id[L]]>val[id[S]]) swap(id[L], id[S]);

		if(val[id[S]]>val[id[R]]) swap(id[S], id[R]);

		int i=L, j=R, p=val[id[S]];

		while(1) {

			while(i<=R && val[id[i]]<=p) i++;

			while(j>=L && val[id[j]]>=p) j--;

			if(i>j) break;

			swap(id[i], id[j]);

		}

		if(mid<=j) R=j;

		else if(mid>=i) L=i;

		else break;

	}

}

inline void build(int u, int L, int R, int dp=0) {

	LL[u]=L, RR[u]=R;

	if(L+1==R) {

		xmn[u]=xmx[u]=x[id[L]];

		ymn[u]=ymx[u]=y[id[L]];

		return ;

	}

	int ls=u<<1, rs=ls|1, mid=L+R>>1;

	if(dp) select(L, mid, R, x);

	else select(L, mid, R, y);

	dp^=1;

	build(ls, L, mid, dp);

	build(rs, mid, R, dp);

	xmn[u]=min(xmn[ls], xmn[rs]), xmx[u]=max(xmx[ls], xmx[rs]);

	ymn[u]=min(ymn[ls], ymn[rs]), ymx[u]=max(ymx[ls], ymx[rs]);

}

int ax, ay, bx, by;

inline bool calc(int u) {

	if(xmn[u]>bx || xmx[u]<ax || ymn[u]>by || ymx[u]<ay) return false;

	if(ax<=xmn[u] && xmx[u]<=bx && ay<=ymn[u] && ymx[u]<=by) return true;

	if(LL[u]+1==RR[u]) return false;

	int ls=u<<1;

	if(calc(ls)) return true;

	return calc(ls|1);

}

pi3 p[NN];

int n, m;

inline bool can(int T) {

	ax=ay=-inf, bx=by=inf;

	for(int i=0; i<n; i++) {

		if(ax<=bx && ay<=by) {

			if(m && p[i].y<=T) {

				int d=T-p[i].y;

				ax-=d, bx+=d, ay-=d, by+=d;

				if(calc(1)) return true;

				ax+=d, bx-=d, ay+=d, by-=d;

			}

		}

		else return false;

		int x=p[i].x.x, y=p[i].x.y;

		smax(ax, x-T), smin(bx, x+T);

		smax(ay, y-T), smin(by, y+T);

	}

	return ax<=bx && ay<=by;

}

main() {

#ifndef	ONLINE_JUDGE

	freopen("in.in", "r", stdin);

	freopen("out.out", "w", stdout);

#endif

	srand(time(0));

	scanf("%d %d", &n, &m);

	if(n==1) return puts("0");

	for(int i=0, x, y; i<n; i++) {

		scanf("%d %d", &x, &y);

		p[i]=pi3(pii(x-y, x+y), 0);

	}

	for(int i=0, x, y; i<m; i++) {

		scanf("%d %d", &x, &y);

		::x[i]=x-y;

		::y[i]=x+y;

		id[i]=i;

	}

	if(m) build(1, 0, m);

	for(int i=0, x, y; i<n; i++) {

		x=p[i].x.x, y=p[i].x.y;

		int st=-1, ed=inf;

		while(st+1<ed) {

			int md=st+ed>>1;

			ax=x-md, bx=x+md, ay=y-md, by=y+md;

			if(m && calc(1)) ed=md;

			else st=md;

		}

		p[i].y=ed;

//		cout<<x<<' '<<y<<' '<<ed<<endl;

	}

	sort(p, p+n, [](pi3 a, pi3 b) {return a.y>b.y;});

	int st=-1, ed=inf;

	while(st+1<ed) {

		int md=st+ed>>1;

		if(can(md)) ed=md;

		else st=md;

	}

	printf("%d", ed);

}


#include"bits/stdc++.h"
#define inf 0x3f3f3f3f
#define MM 400400
#define NN 100100
#define y second
#define x first

using namespace std;
typedef pair<int, int> pii;
typedef pair<pii, int> pi3;
template<typename A, typename B> inline void smin(A &a, const B &b) {if(a>b) a=b;}
template<typename A, typename B> inline void smax(A &a, const B &b) {if(a<b) a=b;}

int id[NN], LL[MM], RR[MM];
int x[NN], y[NN], xmn[MM], xmx[MM], ymn[MM], ymx[MM];
int xx[MM], yy[MM];

inline void select(int L, int mid, int R, int *val) {
	R--; int i, j, p, S, X;
	while(L+1<=R) {
		if(L+1==R) {
			if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
			return ;
		}
		S=L+1, X=S+rand()*rand()%(R-L);
		swap(id[L], id[X]);
		if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
		if(val[id[L]]>val[id[S]]) swap(id[L], id[S]);
		if(val[id[S]]>val[id[R]]) swap(id[S], id[R]);
		i=L, j=R, p=val[id[S]];
		while(true) {
			while(i<=R && val[id[i]]<=p) i++;
			while(j>=L && val[id[j]]>=p) j--;
			if(i>j) break; swap(id[i], id[j]);
		}
		if(mid<=j) R=j;
		else if(mid>=i) L=i;
		else break;
	}
}

inline void build(int u, int L, int R, int dp=0) {
	LL[u]=L, RR[u]=R;
	if(L+1==R) {
		xmn[u]=xmx[u]=xx[u]=x[id[L]];
		ymn[u]=ymx[u]=yy[u]=y[id[L]];
		return ;
	}
	int ls=u<<1, rs=ls|1, mid=L+R>>1;

	if(dp) select(L, mid, R, x);
	else select(L, mid, R, y);

	dp^=1;
	build(ls, L, mid, dp);
	build(rs, mid, R, dp);

	xmn[u]=min(xmn[ls], xmn[rs]), xmx[u]=max(xmx[ls], xmx[rs]);
	ymn[u]=min(ymn[ls], ymn[rs]), ymx[u]=max(ymx[ls], ymx[rs]);

	if(rand()&1) xx[u]=xx[ls], yy[u]=yy[ls];
	else xx[u]=xx[rs], yy[u]=yy[rs];
}

pi3 p[NN];
int X, Y, mn;

inline void calc(int u) {
	int x_x=0, y_y=0;
	if(X>xmx[u]) x_x=X-xmx[u];
	if(X<xmn[u]) x_x=xmn[u]-X;
	if(Y>ymx[u]) y_y=Y-ymx[u];
	if(Y<ymn[u]) y_y=ymn[u]-Y;
	if(max(x_x, y_y)>mn) return ;
	int L=LL[u], R=RR[u];
	if(L+1==R) {
		smin(mn, max(abs(X-x[id[L]]), abs(Y-y[id[L]])));
		return ;
	}
	smin(mn, max(abs(X-xx[u]), abs(Y-yy[u])));

	int ls=u<<1;
	calc(ls), calc(ls|1);
}

int n, k, ax, ay, bx, by;

inline bool in(int u) {
	if( bx<xmn[u] || xmx[u]<ax  ||  by<ymn[u] || ymx[u]<ay) return false;
	if(ax<=xmn[u] && xmx[u]<=bx && ay<=ymn[u] && ymx[u]<=by) return true;
	if(LL[u]+1==RR[u]) return false;
	int ls=u<<1;
	if(in(ls)) return true;
	return in(ls|1);
}

inline bool can(int d) {
	ax=ay=-inf, bx=by=inf;
	for(int i=1; i<=n; i++) {
		if(ax<=bx && ay<=by) {
			if(k && p[i].y<=d) {
				int T=d-p[i].y;
				ax-=T, ay-=T, bx+=T, by+=T;
				if(in(1)) return true;
				ax+=T, ay+=T, bx-=T, by-=T;
			}
		}
		else return false;
		X=p[i].x.x, Y=p[i].x.y;
		smax(ax, X-d), smin(bx, X+d);
		smax(ay, Y-d), smin(by, Y+d);
	}
	return ax<=bx && ay<=by;
}

main() {
#ifndef ONLINE_JUDGE
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
#endif

	srand(time(0));

	scanf("%d %d", &n, &k);
	for(int i=1, x, y; i<=n; i++) {
		scanf("%d %d", &x, &y);
		p[i].x={x-y, x+y};
	}
	if(k) {
		for(int i=1, x, y; i<=k; i++) {
			scanf("%d %d", &x, &y);
			::x[i]=x-y, ::y[i]=x+y, id[i]=i;
		}
		build(1, 1, k+1);

		for(int i=1; i<=n; i++) {
			mn=inf;
			X=p[i].x.x, Y=p[i].x.y;
			calc(1);
			p[i].y=mn;
		}
		sort(p+1, p+n+1, [](pi3 a, pi3 b) {return a.y>b.y;});
	}

	int st=-1, ed=200000000;
	while(ed-st>1) {
		int md=st+ed>>1;
		if(can(md)) ed=md;
		else st=md;
	}
	printf("%d", ed);
}


#include"bits/stdc++.h"
#define inf 0x3f3f3f3f
#define MM 400400
#define NN 100100
#define y second
#define x first

using namespace std;
typedef pair<int, int> pii;
typedef pair<pii, int> pi3;
template<typename A, typename B> inline void smin(A &a, const B &b) {if(a>b) a=b;}
template<typename A, typename B> inline void smax(A &a, const B &b) {if(a<b) a=b;}

int id[NN], LL[MM], RR[MM];
int x[NN], y[NN], xmn[MM], xmx[MM], ymn[MM], ymx[MM];

inline void select(int L, int mid, int R, int *val) {
	R--; int i, j, p, S, X;
	while(L+1<=R) {
		if(L+1==R) {
			if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
			return ;
		}
		S=L+1, X=S+rand()*rand()%(R-L);
		swap(id[L], id[X]);
		if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
		if(val[id[L]]>val[id[S]]) swap(id[L], id[S]);
		if(val[id[S]]>val[id[R]]) swap(id[S], id[R]);
		i=L, j=R, p=val[id[S]];
		while(true) {
			while(i<=R && val[id[i]]<=p) i++;
			while(j>=L && val[id[j]]>=p) j--;
			if(i>j) break; swap(id[i], id[j]);
		}
		if(mid<=j) R=j;
		else if(mid>=i) L=i;
		else break;
	}
}

inline void build(int u, int L, int R, int dp=0) {
	LL[u]=L, RR[u]=R;
	if(L+1==R) {
		xmn[u]=xmx[u]=x[id[L]];
		ymn[u]=ymx[u]=y[id[L]];
		return ;
	}
	int ls=u<<1, rs=ls|1, mid=L+R>>1;

	if(dp) select(L, mid, R, x);
	else select(L, mid, R, y);

	dp^=1;
	build(ls, L, mid, dp);
	build(rs, mid, R, dp);

	xmn[u]=min(xmn[ls], xmn[rs]), xmx[u]=max(xmx[ls], xmx[rs]);
	ymn[u]=min(ymn[ls], ymn[rs]), ymx[u]=max(ymx[ls], ymx[rs]);
}

pi3 p[NN];
int X, Y, mn;

inline bool find(int u) {
	int L=LL[u], R=RR[u];
	if(R-L<=2) {
		for(int i=L; i<R; i++) {
			smin(mn, max(abs(X-x[id[i]]), abs(Y-y[id[i]])));
		}
		return true;
	}
	int ls=u<<1;
	if(find(ls)) return true;
	return find(ls|1);
}

inline void calc(int u) {
	int x_x=0, y_y=0;
	if(X>xmx[u]) x_x=X-xmx[u];
	if(X<xmn[u]) x_x=xmn[u]-X;
	if(Y>ymx[u]) y_y=Y-ymx[u];
	if(Y<ymn[u]) y_y=ymn[u]-Y;
	if(max(x_x, y_y)>mn) return ;
	int L=LL[u], R=RR[u];
	if(L+1==R) {
		smin(mn, max(abs(X-x[id[L]]), abs(Y-y[id[L]])));
		return ;
	}
	int ls=u<<1;
	calc(ls), calc(ls|1);
}

int n, k, ax, ay, bx, by;

inline bool in(int u) {
	if( bx<xmn[u] || xmx[u]<ax  ||  by<ymn[u] || ymx[u]<ay) return false;
	if(ax<=xmn[u] && xmx[u]<=bx && ay<=ymn[u] && ymx[u]<=by) return true;
	if(LL[u]+1==RR[u]) return false;
	int ls=u<<1;
	if(in(ls)) return true;
	return in(ls|1);
}

inline bool can(int d) {
	ax=ay=-inf, bx=by=inf;
	for(int i=1; i<=n; i++) {
		if(ax<=bx && ay<=by) {
			if(k && p[i].y<=d) {
				int T=d-p[i].y;
				ax-=T, ay-=T, bx+=T, by+=T;
				if(in(1)) return true;
				ax+=T, ay+=T, bx-=T, by-=T;
			}
		}
		else return false;
		X=p[i].x.x, Y=p[i].x.y;
		smax(ax, X-d), smin(bx, X+d);
		smax(ay, Y-d), smin(by, Y+d);
	}
	return ax<=bx && ay<=by;
}

main() {
#ifndef ONLINE_JUDGE
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
#endif

	srand(time(0));

	scanf("%d %d", &n, &k);
	for(int i=1, x, y; i<=n; i++) {
		scanf("%d %d", &x, &y);
		p[i].x={x-y, x+y};
	}
	if(k) {
		for(int i=1, x, y; i<=k; i++) {
			scanf("%d %d", &x, &y);
			::x[i]=x-y, ::y[i]=x+y, id[i]=i;
		}
		build(1, 1, k+1);

		for(int i=1; i<=n; i++) {
			mn=inf;
			X=p[i].x.x, Y=p[i].x.y;
			int st=-1, ed=400000000;
			while(ed-st>1) {
				int md=st+ed>>1;
				ax=X-md, ay=Y-md, bx=X+md, by=Y+md;
				if(in(1)) ed=md;
				else st=md;
			}
			p[i].y=ed;
		}
		sort(p+1, p+n+1, [](pi3 a, pi3 b) {return a.y>b.y;});
	}

	int st=-1, ed=200000000;
	while(ed-st>1) {
		int md=st+ed>>1;
		if(can(md)) ed=md;
		else st=md;
	}
	printf("%d", ed);
}


#include<bits/stdc++.h>

using namespace std;

typedef long long INT;

#define NN 1000100

INT ans[NN], pw[NN];
int pr[NN];
int arr[NN];
int nn = 0;

int main(){
#ifndef ONLINE_JUDGE
	freopen("in.in","r",stdin);
	freopen("out.out","w",stdout);
#endif
//	ios_base::sync_with_stdio(0); //cin.tie(0);

	for(int i=2; i<NN; i++) if(!pr[i]) {
		arr[++nn] = i;
		for(int j=i; j<NN; j+=i) pr[j] = i;
	}

	int m;
	cin >> m;
	while(m--) {
		int p; INT a;
		cin >> p >> a;
		ans[p] = a;
	}

	INT k; cin >> k;
	for(int i=1; i<NN; i++) pw[i] = k;
	int flag = 1;

	while(flag) {
		flag = 0;
		for(int ii=1; ii<=nn; ii++) {
			int i = arr[ii];
			if(ans[i]) {
				if(!pw[i]) continue; flag = 1;
				INT mn = min(pw[i], ans[i]); pw[i] -= mn; ans[i] -= mn;
				int x = i - 1;
				while(x > 1) {
					int p = pr[x]; x /= pr[x];
					ans[p] += mn;
				}
			} else if(pw[arr[ii]] == pw[arr[nn]]) pw[arr[ii]]--;
		}
	}

	int cnt = 0;
	for(int i=1; i<NN; i++) if(ans[i]) cnt++;
//	printf("%d\n", cnt);
	cout << cnt << endl;
	for(int i=1; i<NN; i++) if(ans[i]) {
//		cout << i << ' ' << ans[i] << endl;
		printf("%d %I64d\n", i, ans[i]);
	}
	return 0;
}


#include<bits/stdc++.h>

#define x first

#define y second

#define pb push_back

using namespace std;

typedef long long INT;

typedef vector<int> VI;

typedef pair<int, int> pii;

template<typename T, typename U> inline void smin(T &a, const U &b) {if(a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, const U &b) {if(a<b) a=b;}

template <class T> inline void gn(T &x) {char c, sg=0; while(c=getchar(), (c>'9' || c<'0') && c!='-'); for((c=='-' ? sg=1, c=getchar() : 0), x=0; c>='0' && c<='9'; c=getchar()) x=(x<<1)+(x<<3)+c-'0'; if(sg) x=-x;}

template <class T1, class T2> inline void gn(T1 &x1, T2 &x2) {gn(x1), gn(x2);}

int power(int a, int b, int m, int ans=1){for (; b; b>>=1, a=1LL*a*a%m) if (b&1) ans=1LL*ans*a%m; return ans;}

#define NN 100100

pii p[NN<<1];

#define MM 5000000

#define mid (L+R>>1)

int sum[MM], ls[MM], rs[MM];

int root[NN];

int cur;

void push_up(int u){

	sum[u]=sum[ls[u]]+sum[rs[u]];

}

int build(int L, int R){

	int u=cur++;

	if(L+1==R){

		return u;

	}

	ls[u]=build(L, mid);

	rs[u]=build(mid, R);

	return u;

}

int clone(int u){

	int ans=cur++;

	ls[ans]=ls[u];

	rs[ans]=rs[u];

	sum[ans]=sum[u];

	return ans;

}

int update(int u, int L, int R, int p){

	if(p<L || R<=p) return u;

	int ans=clone(u);

	if(L+1==R){

		sum[ans]++;

		return ans;

	}

	ls[ans]=update(ls[u], L, mid, p);

	rs[ans]=update(rs[u], mid, R, p);

	push_up(ans);

	return ans;

}

int calc(int st, int ed, int L, int R, int l, int r){

	if(r<=L || R<=l) return 0;

	if(l<=L && R<=r) return sum[st]-sum[ed];

	return calc(ls[st], ls[ed], L, mid, l, r)||calc(rs[st], rs[ed], mid, R, l, r);

}

VI X, Y;

int calc(int x1, int y1, int x2, int y2){

	x1=lower_bound(X.begin(), X.end(), x1)-X.begin();

	x2=upper_bound(X.begin(), X.end(), x2)-X.begin();

	y1=lower_bound(Y.begin(), Y.end(), y1)-Y.begin();

	y2=upper_bound(Y.begin(), Y.end(), y2)-Y.begin();

	return calc(root[x1], root[x2], 0, Y.size(), y1, y2);

}

int id[NN], dis[NN];

int main(){

#ifndef ONLINE_JUDGE

	freopen("in.in", "r", stdin);

	freopen("out.out", "w", stdout);

#endif

	int n, k;

	cin >> n >> k;

	for(int i=0, x, y; i<n+k; i++){

		gn(x, y);

		p[i]=pii(x+y, x-y);

	}

	pii *q=p+n;

	for(int i=0; i<k; i++){

		X.pb(q[i].x);

		Y.pb(q[i].y);

	}

	sort(X.begin(), X.end());

	X.resize(unique(X.begin(), X.end())-X.begin());

	sort(Y.begin(), Y.end());

	Y.resize(unique(Y.begin(), Y.end())-Y.begin());

	for(int i=0; i<k; i++){

		q[i].x=lower_bound(X.begin(), X.end(), q[i].x)-X.begin();

		q[i].y=lower_bound(Y.begin(), Y.end(), q[i].y)-Y.begin();

	}

	for(int i=0; i<n; i++) id[i]=i;

	if(k){

		sort(q, q+k, [](pii a, pii b){return a.x>b.x;});

		root[X.size()]=build(0, Y.size());

		for(int i=X.size(), j=0; i--; ){

			root[i]=root[i+1];

			while(j<k && q[j].x==i){

				root[i]=update(root[i], 0, Y.size(), q[j].y);

				j++;

			}

		}

		for(int i=0; i<n; i++){

			int st=-1, ed=1e9, md;

			while(ed-st>1){

				md=st+ed>>1;

				if(calc(p[i].x-md, p[i].y-md, p[i].x+md, p[i].y+md)) ed=md;

				else st=md;

			}

			dis[i]=ed;

		}

		sort(id, id+n, [](int a, int b){return dis[a]>dis[b];});

	}

	int st=-1, ed=1e9, md;

	while(ed-st>1){

		md=st+ed>>1;

		int x1=-1e9, y1=-1e9, x2=1e9, y2=1e9;

		int ok=0;

		for(int i=0; i<n; i++){

			if(k){

				int rem=md-dis[id[i]];

				if(rem>=0 && calc(x1-rem, y1-rem, x2+rem, y2+rem)){

					ok=1;

					break;

				}

			}

			smax(x1, p[id[i]].x-md);

			smax(y1, p[id[i]].y-md);

			smin(x2, p[id[i]].x+md);

			smin(y2, p[id[i]].y+md);

			if(x1>x2 || y1>y2) break;

		}

		if(ok || x1<=x2 && y1<=y2) ed=md;

		else st=md;

	}

	cout << ed << endl;

	return 0;

}


#include<bits/stdc++.h>

#define inf 0x3f3f3f3f

#define y second

#define x first

using namespace std;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

template<typename T, typename U> inline void smin(T &a, const U &b) {if(a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, const U &b) {if(a<b) a=b;}

#define NN 100100

#define MM 400400

int id[NN], LL[MM], RR[MM];

int x[NN], y[NN], xmn[MM], xmx[MM], ymn[MM], ymx[MM];

inline void select(int L, int mid, int R, int* val) {

	R--;

	while(L+1<=R) {

		if(L+1==R) {

			if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);

			return ;

		}

		int S=L+1, X=S+rand()*rand()%(R-L);

		swap(id[L], id[X]);

		if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);

		if(val[id[L]]>val[id[S]]) swap(id[L], id[S]);

		if(val[id[S]]>val[id[R]]) swap(id[S], id[R]);

		int i=L, j=R, p=val[id[S]];

		while(1) {

			while(i<=R && val[id[i]]<=p) i++;

			while(j>=L && val[id[j]]>=p) j--;

			if(i>j) break;

			swap(id[i], id[j]);

		}

		if(mid<=j) R=j;

		else if(mid>=i) L=i;

		else break;

	}

}

inline void build(int u, int L, int R, int dp=0) {

	LL[u]=L, RR[u]=R;

	if(L+1==R) {

		xmn[u]=xmx[u]=x[id[L]];

		ymn[u]=ymx[u]=y[id[L]];

		return ;

	}

	int ls=u<<1, rs=ls|1, mid=L+R>>1;

	if(dp) select(L, mid, R, x);

	else select(L, mid, R, y);

	dp^=1;

	build(ls, L, mid, dp);

	build(rs, mid, R, dp);

	xmn[u]=min(xmn[ls], xmn[rs]), xmx[u]=max(xmx[ls], xmx[rs]);

	ymn[u]=min(ymn[ls], ymn[rs]), ymx[u]=max(ymx[ls], ymx[rs]);

}

int ax, ay, bx, by;

inline bool calc(int u) {

	if(xmn[u]>bx || xmx[u]<ax || ymn[u]>by || ymx[u]<ay) return false;

	if(ax<=xmn[u] && xmx[u]<=bx && ay<=ymn[u] && ymx[u]<=by) return true;

	if(LL[u]+1==RR[u]) return false;

	int ls=u<<1;

	if(calc(ls)) return true;

	return calc(ls|1);

}

pi3 p[NN];

int n, m;

inline bool can(int T) {

	ax=ay=-inf, bx=by=inf;

	for(int i=0; i<n; i++) {

		if(ax<=bx && ay<=by) {

			if(m && p[i].y<=T) {

				int d=T-p[i].y;

				ax-=d, bx+=d, ay-=d, by+=d;

				if(calc(1)) return true;

				ax+=d, bx-=d, ay+=d, by-=d;

			}

		}

		else return false;

		int x=p[i].x.x, y=p[i].x.y;

		smax(ax, x-T), smin(bx, x+T);

		smax(ay, y-T), smin(by, y+T);

	}

	return ax<=bx && ay<=by;

}

main() {

#ifndef	ONLINE_JUDGE

	freopen("in.in", "r", stdin);

	freopen("out.out", "w", stdout);

#endif

	srand(time(0));

	scanf("%d %d", &n, &m);

	if(n==1) return puts("0");

	for(int i=0, x, y; i<n; i++) {

		scanf("%d %d", &x, &y);

		p[i]=pi3(pii(x-y, x+y), 0);

	}

	for(int i=0, x, y; i<m; i++) {

		::x[i]=x-y;

		::y[i]=x+y;

		id[i]=i;

	}

	if(m) build(1, 0, m);

	for(int i=0, x, y; i<n; i++) {

		x=p[i].x.x, y=p[i].x.y;

		int st=-1, ed=inf;

		while(st+1<ed) {

			int md=st+ed>>1;

			ax=x-md, bx=x+md, ay=y-md, by=y+md;

			if(m && calc(1)) ed=md;

			else st=md;

		}

		p[i].y=ed;

	}

	sort(p, p+n, [](pi3 a, pi3 b) {return a.y>b.y;});

	int st=-1, ed=inf;

	while(st+1<ed) {

		int md=st+ed>>1;

		if(can(md)) ed=md;

		else st=md;

	}

	printf("%d", ed);

}


#include"bits/stdc++.h"
#define inf 0x3f3f3f3f
#define MM 400400
#define NN 100100
#define y second
#define x first

using namespace std;
typedef pair<int, int> pii;
typedef pair<pii, int> pi3;
template<typename A, typename B> inline void smin(A &a, const B &b) {if(a>b) a=b;}
template<typename A, typename B> inline void smax(A &a, const B &b) {if(a<b) a=b;}

int id[NN], LL[MM], RR[MM];
int x[NN], y[NN], xmn[MM], xmx[MM], ymn[MM], ymx[MM];

inline void select(int L, int mid, int R, int *val) {
	R--; int i, j, p, S, X;
	while(L+1<=R) {
		if(L+1==R) {
			if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
			return ;
		}
		S=L+1, X=S+rand()*rand()%(R-L);
		swap(id[L], id[X]);
		if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
		if(val[id[L]]>val[id[S]]) swap(id[L], id[S]);
		if(val[id[S]]>val[id[R]]) swap(id[S], id[R]);
		i=L, j=R, p=val[id[S]];
		while(true) {
			while(i<=R && val[id[i]]<=p) i++;
			while(j>=L && val[id[j]]>=p) j--;
			if(i>j) break; swap(id[i], id[j]);
		}
		if(mid<=j) R=j;
		else if(mid>=i) L=i;
		else break;
	}
}

inline void build(int u, int L, int R, int dp=0) {
	LL[u]=L, RR[u]=R;
	if(L+1==R) {
		xmn[u]=xmx[u]=x[id[L]];
		ymn[u]=ymx[u]=y[id[L]];
		return ;
	}
	int ls=u<<1, rs=ls|1, mid=L+R>>1;

	if(dp) select(L, mid, R, x);
	else select(L, mid, R, y);

	dp^=1;
	build(ls, L, mid, dp);
	build(rs, mid, R, dp);

	xmn[u]=min(xmn[ls], xmn[rs]), xmx[u]=max(xmx[ls], xmx[rs]);
	ymn[u]=min(ymn[ls], ymn[rs]), ymx[u]=max(ymx[ls], ymx[rs]);
}

pi3 p[NN];
int X, Y, mn;

inline bool find(int u) {
	int L=LL[u], R=RR[u];
	if(R-L<=4) {
		for(int i=L; i<R; i++) {
			smin(mn, max(abs(X-x[id[i]]), abs(Y-y[id[i]])));
		}
		return true;
	}
	int ls=u<<1;
	if(!find(ls)) return find(ls|1);
	return true;
}

inline void calc(int u) {
	int x_x=0, y_y=0;
	if(X>xmx[u]) x_x=X-xmx[u];
	if(X<xmn[u]) x_x=xmn[u]-X;
	if(Y>ymx[u]) y_y=Y-ymx[u];
	if(Y<ymn[u]) y_y=ymn[u]-Y;
	if(max(x_x, y_y)>mn) return ;
	int L=LL[u], R=RR[u];
	if(L+1==R) {
		smin(mn, max(abs(X-x[id[L]]), abs(Y-y[id[L]])));
		return ;
	}
	int ls=u<<1;
	calc(ls), calc(ls|1);
}

int n, k, ax, ay, bx, by;

inline bool in(int u) {
	if(xmx[u]<ax || bx<xmn[u]) return false;
	if(ymx[u]<ay || by<ymn[u]) return false;
	if(xmn[u]<=ax && bx<=xmx[u] && ymn[u]<=ay && by<=ymx[u]) return true;
	if(LL[u]+1==RR[u]) return false;
	int ls=u<<1;
	if(!in(ls)) return in(ls|1);
	return true;
}

inline bool can(int d) {
	int Xmn=-inf, Ymn=-inf, Xmx=inf, Ymx=inf, id=1;
	for(; id<=n && p[id].y>d; id++) {
		smax(Xmn, p[id].x.x-d), smin(Xmx, p[id].x.x+d); if(Xmn>Xmx) return false;
		smax(Ymn, p[id].x.y-d), smin(Ymx, p[id].x.y+d); if(Ymn>Ymx) return false;
	}
	for(; id<=n; id++) {
		int len=d-p[id].y;
		ax=Xmn-len, ay=Ymn-len, bx=Xmx+len, by=Ymx+len;
		if(k && in(1)) return true;
		smax(Xmn, p[id].x.x-d); smin(Xmx, p[id].x.x+d);
		smax(Ymn, p[id].x.y-d); smin(Ymx, p[id].x.y+d);
		if(Xmn>Xmx || Ymn>Ymx) return false;
	}
	return true;
}

main() {
	srand(time(0));

	scanf("%d %d", &n, &k);
	for(int i=1, x, y; i<=n; i++) {
		scanf("%d %d", &x, &y);
		p[i].x={x-y, x+y};
	}
	if(k) {
		for(int i=1, x, y; i<=k; i++) {
			scanf("%d %d", &x, &y);
			::x[i]=x-y, ::y[i]=x+y, id[i]=i;
		}
		build(1, 1, k+1);

		for(int i=1; i<=n; i++) {
			mn=inf;
			X=p[i].x.x, Y=p[i].x.y;
			find(1), calc(1);
			p[i].y=mn;
		}
		sort(p+1, p+n+1, [](pi3 a, pi3 b) {return a.y>b.y;});
	}

	int st=-1, ed=200000000;
	while(ed-st>1) {
		int md=st+ed>>1;
		if(can(md)) ed=md;
		else st=md;
	}
	printf("%d", ed);
}


#include"bits/stdc++.h"
#define inf 0x3f3f3f3f
#define MM 800400
#define NN 200100
#define y second
#define x first

using namespace std;
typedef pair<int, int> pii;
typedef pair<pii, int> pi3;
template<typename A, typename B> inline void smin(A &a, const B &b) {if(a>b) a=b;}
template<typename A, typename B> inline void smax(A &a, const B &b) {if(a<b) a=b;}

int id[NN], LL[MM], RR[MM];
int x[NN], y[NN], xmn[MM], xmx[MM], ymn[MM], ymx[MM];

inline void select(int L, int mid, int R, int *val) {
	R--; int i, j, p, S, X;
	while(L+1<=R) {
		if(L+1==R) {
			if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
			return ;
		}
		S=L+1, X=S+rand()*rand()%(R-L);
		swap(id[L], id[X]);
		if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
		if(val[id[L]]>val[id[S]]) swap(id[L], id[S]);
		if(val[id[S]]>val[id[R]]) swap(id[S], id[R]);
		i=L, j=R, p=val[id[S]];
		while(true) {
			while(i<=R && val[id[i]]<=p) i++;
			while(j>=L && val[id[j]]>=p) j--;
			if(i>j) break; swap(id[i], id[j]);
		}
		if(mid<=j) R=j;
		else if(mid>=i) L=i;
		else break;
	}
}

inline void build(int u, int L, int R, int dp=0) {
	LL[u]=L, RR[u]=R;
	if(L+1==R) {
		xmn[u]=xmx[u]=x[id[L]];
		ymn[u]=ymx[u]=y[id[L]];
		return ;
	}
	int ls=u<<1, rs=ls|1, mid=L+R>>1;

	if(dp) select(L, mid, R, x);
	else select(L, mid, R, y);

	dp^=1;
	build(ls, L, mid, dp);
	build(rs, mid, R, dp);

	xmn[u]=min(xmn[ls], xmn[rs]), xmx[u]=max(xmx[ls], xmx[rs]);
	ymn[u]=min(ymn[ls], ymn[rs]), ymx[u]=max(ymx[ls], ymx[rs]);
}

pi3 p[NN];
int X, Y, I, mn;

inline bool find(int u) {
	int L=LL[u], R=RR[u];
	if(R-L<=4) {
		for(int i=L; i<R; i++) if(id[i]!=I) {
			smin(mn, max(abs(X-x[id[i]]), abs(Y-y[id[i]])));
		}
		return true;
	}
	int ls=u<<1;
	if(find(ls)) return true;
	return find(ls|1);
}

inline void calc(int u) {
	int x_x=0, y_y=0;
	if(X>xmx[u]) x_x=X-xmx[u];
	if(X<xmn[u]) x_x=xmn[u]-X;
	if(Y>ymx[u]) y_y=Y-ymx[u];
	if(Y<ymn[u]) y_y=ymn[u]-Y;
	if(max(x_x, y_y)>mn) return ;
	int L=LL[u], R=RR[u];
	if(L+1==R) {
		if(id[L]!=I) smin(mn, max(abs(X-x[id[L]]), abs(Y-y[id[L]])));
		return ;
	}
	int ls=u<<1;
	calc(ls), calc(ls|1);
}

int n, k, ax, ay, bx, by;
inline bool in(int u) {
	if( bx<xmn[u] || xmx[u]<ax  ||  by<ymn[u] || ymx[u]<ay) return false;
	if(ax<=xmn[u] && xmx[u]<=bx && ay<=ymn[u] && ymx[u]<=by) return true;
	if(LL[u]+1==RR[u]) return false;
	int ls=u<<1;
	if(in(ls)) return true;
	return in(ls|1);
}

inline bool can(int d) {
	ax=ay=-inf, bx=by=inf;
	for(int i=1; i<=n; i++) {
		if(ax<=bx && ay<=by) {
			if(k && p[i].y<=d) {
				int T=d-p[i].y;
				ax-=T, ay-=T, bx+=T, by+=T;
				if(in(1)) return true;
				ax+=T, ay+=T, bx-=T, by-=T;
			}
		}
		else return false;
		X=p[i].x.x, Y=p[i].x.y;
		smax(ax, X-d), smin(bx, X+d);
		smax(ay, Y-d), smin(by, Y+d);
	}
	return ax<=bx && ay<=by;
}

main() {
	srand(time(0));

	scanf("%d %d", &n, &k);
	for(int i=1, x, y; i<=n; i++) {
		scanf("%d %d", &x, &y);
		p[i].x={x-y, x+y};
	}
	if(k) {
		for(int i=1, x, y; i<=k; i++) {
			scanf("%d %d", &x, &y);
			::x[i]=x-y, ::y[i]=x+y, id[i]=i;
		}
		for(int i=1, u; i<=n; i++) {
			u=i+k;
			x[u]=p[i].x.x, y[u]=p[i].x.y, id[u]=u;
		}
		build(1, 1, k+n+1);

		for(int i=1; i<=n; i++) {
			mn=inf, I=k+i;
			X=p[i].x.x, Y=p[i].x.y;
			find(1), calc(1);
			p[i].y=mn;
		}
		sort(p+1, p+n+1, [](pi3 a, pi3 b) {return a.y>b.y;});
	}

	if(k) build(1, 1, k+1);
	int st=-1, ed=200000000;
	while(ed-st>1) {
		int md=st+ed>>1;
		if(can(md)) ed=md;
		else st=md;
	}
	printf("%d", ed);
}


#include"bits/stdc++.h"
#define inf 0x3f3f3f3f
#define MM 800400
#define NN 200100
#define y second
#define x first

using namespace std;
typedef pair<int, int> pii;
typedef pair<pii, int> pi3;
template<typename A, typename B> inline void smin(A &a, const B &b) {if(a>b) a=b;}
template<typename A, typename B> inline void smax(A &a, const B &b) {if(a<b) a=b;}

int id[NN], LL[MM], RR[MM];
int x[NN], y[NN], xmn[MM], xmx[MM], ymn[MM], ymx[MM];

inline void select(int L, int mid, int R, int *val) {
	R--; int i, j, p, S, X;
	while(L+1<=R) {
		if(L+1==R) {
			if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
			return ;
		}
		S=L+1, X=S+rand()*rand()%(R-L);
		swap(id[L], id[X]);
		if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
		if(val[id[L]]>val[id[S]]) swap(id[L], id[S]);
		if(val[id[S]]>val[id[R]]) swap(id[S], id[R]);
		i=L, j=R, p=val[id[S]];
		while(true) {
			while(i<=R && val[id[i]]<=p) i++;
			while(j>=L && val[id[j]]>=p) j--;
			if(i>j) break; swap(id[i], id[j]);
		}
		if(mid<=j) R=j;
		else if(mid>=i) L=i;
		else break;
	}
}

inline void build(int u, int L, int R, int dp=0) {
	LL[u]=L, RR[u]=R;
	if(L+1==R) {
		xmn[u]=xmx[u]=x[id[L]];
		ymn[u]=ymx[u]=y[id[L]];
		return ;
	}
	int ls=u<<1, rs=ls|1, mid=L+R>>1;

	if(dp) select(L, mid, R, x);
	else select(L, mid, R, y);

	dp^=1;
	build(ls, L, mid, dp);
	build(rs, mid, R, dp);

	xmn[u]=min(xmn[ls], xmn[rs]), xmx[u]=max(xmx[ls], xmx[rs]);
	ymn[u]=min(ymn[ls], ymn[rs]), ymx[u]=max(ymx[ls], ymx[rs]);
}

pi3 p[NN];
int X, Y, I, mn;

inline bool find(int u) {
	int L=LL[u], R=RR[u];
	if(R-L<=4) {
		for(int i=L; i<R; i++) if(id[i]!=I) {
			smin(mn, max(abs(X-x[id[i]]), abs(Y-y[id[i]])));
		}
		return true;
	}
	int ls=u<<1;
	if(find(ls)) return true;
	return find(ls|1);
}

inline void calc(int u) {
	int x_x=0, y_y=0;
	if(X>xmx[u]) x_x=X-xmx[u];
	if(X<xmn[u]) x_x=xmn[u]-X;
	if(Y>ymx[u]) y_y=Y-ymx[u];
	if(Y<ymn[u]) y_y=ymn[u]-Y;
	if(max(x_x, y_y)>mn) return ;
	int L=LL[u], R=RR[u];
	if(L+1==R) {
		if(id[L]!=I) smin(mn, max(abs(X-x[id[L]]), abs(Y-y[id[L]])));
		return ;
	}
	int ls=u<<1;
	calc(ls), calc(ls|1);
}

int n, k, ax, ay, bx, by;
inline bool in(int u) {
	if( bx<xmn[u] || xmx[u]<ax  ||  by<ymn[u] || ymx[u]<ay) return false;
	if(ax<=xmn[u] && xmx[u]<=bx && ay<=ymn[u] && ymx[u]<=by) return true;
	if(LL[u]+1==RR[u]) return false;
	int ls=u<<1;
	if(in(ls)) return true;
	return in(ls|1);
}

inline bool can(int d) {
	ax=ay=-inf, bx=by=inf;
	for(int i=1; i<=n; i++) {
		if(ax<=bx && ay<=by) {
			if(k && p[i].y<=d) {
				int T=d-p[i].y;
				ax-=T, ay-=T, bx+=T, by+=T;
				if(in(1)) return true;
				ax+=T, ay+=T, bx-=T, by-=T;
			}
		}
		else return false;
		X=p[i].x.x, Y=p[i].x.y;
		smax(ax, X-d), smin(bx, X+d);
		smax(ay, Y-d), smin(by, Y+d);
	}
	return ax<=bx && ay<=by;
}

main() {
	srand(time(0));

	scanf("%d %d", &n, &k);
	for(int i=1, x, y; i<=n; i++) {
		scanf("%d %d", &x, &y);
		p[i].x={x-y, x+y};
	}
	if(k) {
		for(int i=1, x, y; i<=k; i++) {
			scanf("%d %d", &x, &y);
			::x[i]=x-y, ::y[i]=x+y, id[i]=i;
		}
		for(int i=1, u; i<=n; i++) {
			u=i+k;
			x[u]=p[i].x.x, y[u]=p[i].x.y, id[u]=u;
		}
		build(1, 1, k+n+1);

		for(int i=1; i<=n; i++) {
			mn=inf, I=k+i;
			X=p[i].x.x, Y=p[i].x.y;
			find(1), calc(1);
			p[i].y=mn;
		}
		sort(p+1, p+n+1, [](pi3 a, pi3 b) {return a.y>b.y;});
	}

	build(1, 1, k+1);
	int st=-1, ed=200000000;
	while(ed-st>1) {
		int md=st+ed>>1;
		if(can(md)) ed=md;
		else st=md;
	}
	printf("%d", ed);
}


#include<bits/stdc++.h>

#define x first

#define y second

#define pb push_back

using namespace std;

typedef long long INT;

typedef vector<int> VI;

typedef pair<int, int> pii;

template<typename T, typename U> inline void smin(T &a, const U &b) {if(a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, const U &b) {if(a<b) a=b;}

template <class T> inline void gn(T &x) {char c, sg=0; while(c=getchar(), (c>'9' || c<'0') && c!='-'); for((c=='-' ? sg=1, c=getchar() : 0), x=0; c>='0' && c<='9'; c=getchar()) x=(x<<1)+(x<<3)+c-'0'; if(sg) x=-x;}

template <class T1, class T2> inline void gn(T1 &x1, T2 &x2) {gn(x1), gn(x2);}

int power(int a, int b, int m, int ans=1){for (; b; b>>=1, a=1LL*a*a%m) if (b&1) ans=1LL*ans*a%m; return ans;}

#define NN 100100

pii p[NN<<1];

#define MM 5000000

#define mid (L+R>>1)

int sum[MM], ls[MM], rs[MM];

int root[NN];

int cur;

void push_up(int u){

	sum[u]=sum[ls[u]]+sum[rs[u]];

}

int build(int L, int R){

	int u=cur++;

	if(L+1==R){

		return u;

	}

	ls[u]=build(L, mid);

	rs[u]=build(mid, R);

	return u;

}

int clone(int u){

	int ans=cur++;

	ls[ans]=ls[u];

	rs[ans]=rs[u];

	sum[ans]=sum[u];

	return ans;

}

int update(int u, int L, int R, int p){

	if(p<L || R<=p) return u;

	int ans=clone(u);

	if(L+1==R){

		sum[ans]++;

		return ans;

	}

	ls[ans]=update(ls[u], L, mid, p);

	rs[ans]=update(rs[u], mid, R, p);

	push_up(ans);

	return ans;

}

int calc(int st, int ed, int L, int R, int l, int r){

	if(r<=L || R<=l) return 0;

	if(l<=L && R<=r) return sum[st]-sum[ed];

	return calc(ls[st], ls[ed], L, mid, l, r)||calc(rs[st], rs[ed], mid, R, l, r);

}

VI X, Y;

int calc(int x1, int y1, int x2, int y2){

	x1=lower_bound(X.begin(), X.end(), x1)-X.begin();

	x2=upper_bound(X.begin(), X.end(), x2)-X.begin();

	y1=lower_bound(Y.begin(), Y.end(), y1)-Y.begin();

	y2=upper_bound(Y.begin(), Y.end(), y2)-Y.begin();

	return calc(root[x1], root[x2], 0, Y.size(), y1, y2);

}

int id[NN], dis[NN];

int main(){

#ifndef ONLINE_JUDGE

	freopen("in.in", "r", stdin);

	freopen("out.out", "w", stdout);

#endif

	int n, k;

	cin >> n >> k;

	for(int i=0, x, y; i<n+k; i++){

		gn(x, y);

		p[i]=pii(x+y, x-y);

	}

	pii *q=p+n;

	for(int i=0; i<k; i++){

		X.pb(q[i].x);

		Y.pb(q[i].y);

	}

	sort(X.begin(), X.end());

	X.resize(unique(X.begin(), X.end())-X.begin());

	sort(Y.begin(), Y.end());

	Y.resize(unique(Y.begin(), Y.end())-Y.begin());

	for(int i=0; i<k; i++){

		q[i].x=lower_bound(X.begin(), X.end(), q[i].x)-X.begin();

		q[i].y=lower_bound(Y.begin(), Y.end(), q[i].y)-Y.begin();

	}

	if(k){

		sort(q, q+k, [](pii a, pii b){return a.x>b.x;});

		root[X.size()]=build(0, Y.size());

		for(int i=0, j=0; i<X.size(); i++){

			root[i]=root[i+1];

			while(j<k && q[j].x==i){

				root[i]=update(root[i], 0, Y.size(), q[j].y);

				j++;

			}

		}

		for(int i=0; i<n; i++){

			int st=-1, ed=1e9, md;

			while(ed-st>1){

				md=st+ed>>1;

				if(calc(p[i].x-md, p[i].y-md, p[i].x+md, p[i].y+md)) ed=md;

				else st=md;

			}

			id[i]=i;

			dis[i]=ed;

		}

		sort(id, id+n, [](int a, int b){return dis[a]>dis[b];});

	}

	else for(int i=0; i<n; i++) dis[i]=1e9;

	int st=-1, ed=1e9, md;

	while(ed-st>1){

		md=st+ed>>1;

		int x1=-1e9, y1=-1e9, x2=1e9, y2=1e9;

		int ok=0;

		for(int i=0; i<n; i++){

			int rem=md-dis[id[i]];

			if(k && rem>=0 && calc(x1-rem, y1-rem, x2+rem, y2+rem)){

				ok=1;

				break;

			}

			smax(x1, p[id[i]].x-md);

			smax(y1, p[id[i]].y-md);

			smin(x2, p[id[i]].x+md);

			smin(y2, p[id[i]].y+md);

			if(x1>x2 || y1>y2) break;

		}

		if(ok || x1<=x2 && y1<=y2) ed=md;

		else st=md;

	}

	cout << ed << endl;

	return 0;

}


#include"bits/stdc++.h"
#define inf 0x3f3f3f3f
#define MM 400400
#define NN 100100
#define y second
#define x first

using namespace std;
typedef pair<int, int> pii;
typedef pair<pii, int> pi3;
template<typename A, typename B> inline void smin(A &a, const B &b) {if(a>b) a=b;}
template<typename A, typename B> inline void smax(A &a, const B &b) {if(a<b) a=b;}
int id[NN], LL[MM], RR[MM];
int x[NN], y[NN], xmn[MM], xmx[MM], ymn[MM], ymx[MM];

inline void select(int L, int mid, int R, int *val) {
	R--; int i, j, p, S, X;
	while(L+1<=R) {
		if(L+1==R) {
			if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
			return ;
		}
		S=L+1, X=S+rand()*rand()%(R-L);
		swap(id[L], id[X]);
		if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
		if(val[id[L]]>val[id[S]]) swap(id[L], id[S]);
		if(val[id[S]]>val[id[R]]) swap(id[S], id[R]);
		i=L, j=R, p=val[id[S]];
		while(true) {
			while(i<=R && val[id[i]]<=p) i++;
			while(j>=L && val[id[j]]>=p) j--;
			if(i>j) break; swap(id[i], id[j]);
		}
		if(mid<=j) R=j;
		else if(mid>=i) L=i;
		else break;
	}
}

inline void build(int u, int L, int R, int dp=0) {
	LL[u]=L, RR[u]=R;
	if(L+1==R) {
		xmn[u]=xmx[u]=x[id[L]];
		ymn[u]=ymx[u]=y[id[L]];
		return ;
	}
	int ls=u<<1, rs=ls|1, mid=L+R>>1;

	if(dp) select(L, mid, R, x);
	else select(L, mid, R, y);

	dp^=1;
	build(ls, L, mid, dp);
	build(rs, mid, R, dp);

	xmn[u]=min(xmn[ls], xmn[rs]), xmx[u]=max(xmx[ls], xmx[rs]);
	ymn[u]=min(ymn[ls], ymn[rs]), ymx[u]=max(ymx[ls], ymx[rs]);
}

pi3 p[NN];
int X, Y, mn;

inline bool find(int u) {
	int L=LL[u], R=RR[u];
	if(R-L<=4) {
		for(int i=L; i<R; i++) {
			smin(mn, max(abs(X-x[id[i]]), abs(Y-y[id[i]])));
		}
		return true;
	}
	int ls=u<<1;
	if(!find(ls)) return find(ls|1);
	return true;
}

inline void calc(int u) {
	int x_x=0, y_y=0;
	if(X>xmx[u]) x_x=X-xmx[u];
	if(X<xmn[u]) x_x=xmn[u]-X;
	if(Y>ymx[u]) y_y=Y-ymx[u];
	if(Y<ymn[u]) y_y=ymn[u]-Y;
	if(max(x_x, y_y)>mn) return ;
	int L=LL[u], R=RR[u];
	if(L+1==R) {
		smin(mn, max(abs(X-x[id[L]]), abs(Y-y[id[L]])));
		return ;
	}
	int ls=u<<1;
	calc(ls), calc(ls|1);
}

int n, k, ax, ay, bx, by;

inline bool in(int u) {
	if(xmx[u]<ax || bx<xmn[u]) return false;
	if(ymx[u]<ay || by<ymn[u]) return false;
	if(xmn[u]<=ax && bx<=xmx[u] && ymn[u]<=ay && by<=ymx[u]) return true;
	if(LL[u]+1==RR[u]) return false;
	int ls=u<<1;
	if(!in(ls)) return in(ls|1);
	return true;
}

inline bool can(int d) {
	int Xmn=-inf, Ymn=-inf, Xmx=inf, Ymx=inf, id=1;
	for(; id<=n && p[id].y>d; id++) {
		smax(Xmn, p[id].x.x-d); smin(Xmx, p[id].x.x+d);
		smax(Ymn, p[id].x.y-d); smin(Ymx, p[id].x.y+d);
		if(Xmn>Xmx || Ymn>Ymx) return false;
	}

	for(; id<=n; id++) {
		int len=d-p[id+1].y;
		ax=Xmn-len, ay=Ymn-len, bx=Xmx+len, by=Ymx+len;
		if(k && in(1)) return true;
		smax(Xmn, p[id].x.x-d); smin(Xmx, p[id].x.x+d);
		smax(Ymn, p[id].x.y-d); smin(Ymx, p[id].x.y+d);
		if(Xmn>Xmx || Ymn>Ymx) return false;
	}
	return true;
}

main() {
	srand(time(0));
	scanf("%d %d", &n, &k);
	for(int i=1, x, y; i<=n; i++) {
		scanf("%d %d", &x, &y);
		p[i].x={x-y, x+y};
	}
	if(k) {
		for(int i=1, x, y; i<=k; i++) {
			scanf("%d %d", &x, &y);
			::x[i]=x-y, ::y[i]=x+y;
		}
		build(1, 1, k+1);
		for(int i=1; i<=n; i++) {
			mn=inf;
			X=p[i].x.x, Y=p[i].x.y;
			find(1), calc(1);
			p[i].y=mn;
		}
		sort(p+1, p+n+1, [](pi3 a, pi3 b) {return a.y>b.y;});
	}

	int st=-1, ed=200000000;
	while(ed-st>1) {
		int md=st+ed>>1;
		if(can(md)) ed=md;
		else st=md;
	}
	printf("%d", ed);
}


#include"bits/stdc++.h"
#define inf 0x3f3f3f3f
#define MM 400400
#define NN 100100
#define y second
#define x first

using namespace std;
typedef pair<int, int> pii;
typedef pair<pii, int> pi3;
template<typename A, typename B> inline void smin(A &a, const B &b) {if(a>b) a=b;}
template<typename A, typename B> inline void smax(A &a, const B &b) {if(a<b) a=b;}

int id[NN], LL[MM], RR[MM];
int x[NN], y[NN], xmn[MM], xmx[MM], ymn[MM], ymx[MM];

inline void select(int L, int mid, int R, int *val) {
	R--; int i, j, p, S, X;
	while(L+1<=R) {
		if(L+1==R) {
			if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
			return ;
		}
		S=L+1, X=S+rand()*rand()%(R-L);
		swap(id[L], id[X]);
		if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
		if(val[id[L]]>val[id[S]]) swap(id[L], id[S]);
		if(val[id[S]]>val[id[R]]) swap(id[S], id[R]);
		i=L, j=R, p=val[id[S]];
		while(true) {
			while(i<=R && val[id[i]]<=p) i++;
			while(j>=L && val[id[j]]>=p) j--;
			if(i>j) break; swap(id[i], id[j]);
		}
		if(mid<=j) R=j;
		else if(mid>=i) L=i;
		else break;
	}
}

inline void build(int u, int L, int R, int dp=0) {
	LL[u]=L, RR[u]=R;
	if(L+1==R) {
		xmn[u]=xmx[u]=x[id[L]];
		ymn[u]=ymx[u]=y[id[L]];
		return ;
	}
	int ls=u<<1, rs=ls|1, mid=L+R>>1;

	if(dp) select(L, mid, R, x);
	else select(L, mid, R, y);

	dp^=1;
	build(ls, L, mid, dp);
	build(rs, mid, R, dp);

	xmn[u]=min(xmn[ls], xmn[rs]), xmx[u]=max(xmx[ls], xmx[rs]);
	ymn[u]=min(ymn[ls], ymn[rs]), ymx[u]=max(ymx[ls], ymx[rs]);
}

pi3 p[NN];
int X, Y, mn;

inline bool find(int u) {
	int L=LL[u], R=RR[u];
	if(R-L<=4) {
		for(int i=L; i<R; i++) {
			smin(mn, max(abs(X-x[id[i]]), abs(Y-y[id[i]])));
		}
		return true;
	}
	int ls=u<<1;
	if(!find(ls)) return find(ls|1);
	return true;
}

inline void calc(int u) {
	int x_x=0, y_y=0;
	if(X>xmx[u]) x_x=X-xmx[u];
	if(X<xmn[u]) x_x=xmn[u]-X;
	if(Y>ymx[u]) y_y=Y-ymx[u];
	if(Y<ymn[u]) y_y=ymn[u]-Y;
	if(max(x_x, y_y)>mn) return ;
	int L=LL[u], R=RR[u];
	if(L+1==R) {
		smin(mn, max(abs(X-x[id[L]]), abs(Y-y[id[L]])));
		return ;
	}
	int ls=u<<1;
	calc(ls), calc(ls|1);
}

int n, k, ax, ay, bx, by;

inline bool in(int u) {
	if(xmx[u]<ax || bx<xmn[u]) return false;
	if(ymx[u]<ay || by<ymn[u]) return false;
	if(xmn[u]<=ax && bx<=xmx[u] && ymn[u]<=ay && by<=ymx[u]) return true;
	if(LL[u]+1==RR[u]) return false;
	int ls=u<<1;
	if(!in(ls)) return in(ls|1);
	return true;
}

inline bool can(int d) {
	ax=ay=-inf, bx=by=inf;
	for(int i=1; i<=n; i++) {
		if(ax<=bx && ay<=by) {
			if(k && p[i].y<=d) {
				int Time=d-p[i].y;
				ax-=d, ay-=d, bx+=d, by+=d;
				if(in(1)) return true;
				ax+=d, ay+=d, bx-=d, by-=d;
			}
		}
		else return false;
		X=p[i].x.x, Y=p[i].x.y;
		smax(ax, X-d), smin(bx, X+d);
		smax(ay, Y-d), smin(by, Y+d);
	}
	return ax<=bx && ay<=by;
}

main() {
	srand(time(0));

	scanf("%d %d", &n, &k);
	for(int i=1, x, y; i<=n; i++) {
		scanf("%d %d", &x, &y);
		p[i].x={x-y, x+y};
	}
	if(k) {
		for(int i=1, x, y; i<=k; i++) {
			scanf("%d %d", &x, &y);
			::x[i]=x-y, ::y[i]=x+y, id[i]=i;
		}
		build(1, 1, k+1);

		for(int i=1; i<=n; i++) {
			mn=inf;
			X=p[i].x.x, Y=p[i].x.y;
			find(1), calc(1);
			p[i].y=mn;
		}
		sort(p+1, p+n+1, [](pi3 a, pi3 b) {return a.y>b.y;});
	}

	int st=-1, ed=200000000;
	while(ed-st>1) {
		int md=st+ed>>1;
		if(can(md)) ed=md;
		else st=md;
	}
	printf("%d", ed);
}


#include"bits/stdc++.h"
#define inf 0x3f3f3f3f
#define MM 400400
#define NN 100100
#define y second
#define x first

using namespace std;
typedef pair<int, int> pii;
typedef pair<pii, int> pi3;
template<typename A, typename B> inline void smin(A &a, const B &b) {if(a>b) a=b;}
template<typename A, typename B> inline void smax(A &a, const B &b) {if(a<b) a=b;}

int id[NN], LL[MM], RR[MM];
int x[NN], y[NN], xmn[MM], xmx[MM], ymn[MM], ymx[MM];

inline void select(int L, int mid, int R, int *val) {
	R--; int i, j, p, S, X;
	while(L+1<=R) {
		if(L+1==R) {
			if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
			return ;
		}
		S=L+1, X=S+rand()*rand()%(R-L);
		swap(id[L], id[X]);
		if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
		if(val[id[L]]>val[id[S]]) swap(id[L], id[S]);
		if(val[id[S]]>val[id[R]]) swap(id[S], id[R]);
		i=L, j=R, p=val[id[S]];
		while(true) {
			while(i<=R && val[id[i]]<=p) i++;
			while(j>=L && val[id[j]]>=p) j--;
			if(i>j) break; swap(id[i], id[j]);
		}
		if(mid<=j) R=j;
		else if(mid>=i) L=i;
		else break;
	}
}

inline void build(int u, int L, int R, int dp=0) {
	LL[u]=L, RR[u]=R;
	if(L+1==R) {
		xmn[u]=xmx[u]=x[id[L]];
		ymn[u]=ymx[u]=y[id[L]];
		return ;
	}
	int ls=u<<1, rs=ls|1, mid=L+R>>1;

	if(dp) select(L, mid, R, x);
	else select(L, mid, R, y);

	dp^=1;
	build(ls, L, mid, dp);
	build(rs, mid, R, dp);

	xmn[u]=min(xmn[ls], xmn[rs]), xmx[u]=max(xmx[ls], xmx[rs]);
	ymn[u]=min(ymn[ls], ymn[rs]), ymx[u]=max(ymx[ls], ymx[rs]);
}

pi3 p[NN];
int X, Y, mn;

inline bool find(int u) {
	int L=LL[u], R=RR[u];
	if(R-L<=2) {
		for(int i=L; i<R; i++) {
			smin(mn, max(abs(X-x[id[i]]), abs(Y-y[id[i]])));
		}
		return true;
	}
	int ls=u<<1;
	if(find(ls)) return true;
	return find(ls|1);
}

inline void calc(int u) {
	int x_x=0, y_y=0;
	if(X>xmx[u]) x_x=X-xmx[u];
	if(X<xmn[u]) x_x=xmn[u]-X;
	if(Y>ymx[u]) y_y=Y-ymx[u];
	if(Y<ymn[u]) y_y=ymn[u]-Y;
	if(max(x_x, y_y)>mn) return ;
	int L=LL[u], R=RR[u];
	if(L+1==R) {
		smin(mn, max(abs(X-x[id[L]]), abs(Y-y[id[L]])));
		return ;
	}
	int ls=u<<1;
	calc(ls), calc(ls|1);
}

int n, k, ax, ay, bx, by;

inline bool in(int u) {
	if( bx<xmn[u] || xmx[u]<ax  ||  by<ymn[u] || ymx[u]<ay) return false;
	if(ax<=xmn[u] && xmx[u]<=bx && ay<=ymn[u] && ymx[u]<=by) return true;
	if(LL[u]+1==RR[u]) return false;
	int ls=u<<1;
	if(in(ls)) return true;
	return in(ls|1);
}

inline bool can(int d) {
	ax=ay=-inf, bx=by=inf;
	for(int i=1; i<=n; i++) {
		if(ax<=bx && ay<=by) {
			if(k && p[i].y<=d) {
				int T=d-p[i].y;
				ax-=T, ay-=T, bx+=T, by+=T;
				if(in(1)) return true;
				ax+=T, ay+=T, bx-=T, by-=T;
			}
		}
		else return false;
		X=p[i].x.x, Y=p[i].x.y;
		smax(ax, X-d), smin(bx, X+d);
		smax(ay, Y-d), smin(by, Y+d);
	}
	return ax<=bx && ay<=by;
}

main() {
#ifndef ONLINE_JUDGE
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
#endif

	srand(time(0));

	scanf("%d %d", &n, &k);
	for(int i=1, x, y; i<=n; i++) {
		scanf("%d %d", &x, &y);
		p[i].x={x-y, x+y};
	}
	if(k) {
		for(int i=1, x, y; i<=k; i++) {
			scanf("%d %d", &x, &y);
			::x[i]=x-y, ::y[i]=x+y, id[i]=i;
		}
		build(1, 1, k+1);

		for(int i=1; i<=n; i++) {
			mn=inf;
			X=p[i].x.x, Y=p[i].x.y;
			int st=-1, ed=200000000;
			while(ed-st>1) {
				int md=st+ed>>1;
				ax=X-md, ay=Y-md, bx=X+md, by=Y+md;
				if(in(1)) ed=md;
				else st=md;
			}
			p[i].y=ed;
		}
		sort(p+1, p+n+1, [](pi3 a, pi3 b) {return a.y>b.y;});
	}

	int st=-1, ed=200000000;
	while(ed-st>1) {
		int md=st+ed>>1;
		if(can(md)) ed=md;
		else st=md;
	}
	printf("%d", ed);
}


#include<bits/stdc++.h>

#define inf 0x3f3f3f3f

#define pb push_back

#define y second

#define x first

using namespace std;

typedef long long INT;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

template<typename T, typename U> inline void smin(T &a, const U &b) {if(a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, const U &b) {if(a<b) a=b;}

typedef vector<int> VI;

#define NN 100100

#define MM 400400

int id[NN], LL[MM], RR[MM];

int x[NN], y[NN], xmn[MM], xmx[MM], ymn[MM], ymx[MM];

#define sq(_) ((INT)(_)*(_))

//inline bool cmpx(int u, int v) {return x[u]<x[v];}

//inline bool cmpy(int u, int v) {return y[u]<y[v];}

inline INT dist(int u, int v) {return sq(x[u]-x[v])+sq(y[u]-y[v]);}

inline void select(int L, int mid, int R, int* val) {

	R--;

	while(L+1<=R) {

		if(L+1==R) {

			if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);

			return ;

		}

		int S=L+1, X=S+rand()*rand()%(R-L);

		swap(id[L], id[X]);

		if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);

		if(val[id[L]]>val[id[S]]) swap(id[L], id[S]);

		if(val[id[S]]>val[id[R]]) swap(id[S], id[R]);

		int i=L, j=R, p=val[id[S]];

		while(1) {

			while(i<=R && val[id[i]]<=p) i++;

			while(j>=L && val[id[j]]>=p) j--;

			if(i>j) break;

			swap(id[i], id[j]);

		}

		if(mid<=j) R=j;

		else if(mid>=i) L=i;

		else break;

	}

}

inline void build(int u, int L, int R, int dp=0) {

	LL[u]=L, RR[u]=R;

	if(L+1==R) {

		xmn[u]=xmx[u]=x[id[L]];

		ymn[u]=ymx[u]=y[id[L]];

		return ;

	}

	int ls=u<<1, rs=ls|1, mid=L+R>>1;

	if(dp) select(L, mid, R, x);

	else select(L, mid, R, y);

	dp^=1;

	build(ls, L, mid, dp);

	build(rs, mid, R, dp);

	xmn[u]=min(xmn[ls], xmn[rs]), xmx[u]=max(xmx[ls], xmx[rs]);

	ymn[u]=min(ymn[ls], ymn[rs]), ymx[u]=max(ymx[ls], ymx[rs]);

}

int ax, ay, bx, by;

inline bool calc(int u) {

	if(xmn[u]>bx || xmx[u]<ax || ymn[u]>by || ymx[u]<ay) return false;

	if(ax<=xmn[u] && xmx[u]<=bx && ay<=ymn[u] && ymx[u]<=by) return true;

	int L=LL[u], R=RR[u];

	if(L+1==R) return false;

	int ls=u<<1;

	if(calc(ls)) return true;

	return calc(ls|1);

}

pi3 p[NN];

int n, m;

inline bool can(int T) {

	ax=ay=-inf, bx=by=inf;

	for(int i=0; i<n; i++) {

		int x=p[i].x.x, y=p[i].x.y;

		smax(ax, x-T), smin(bx, x+T);

		smax(ay, y-T), smin(by, y+T);

		if(ax<=bx && ay<=by) {

			if(i==n-1) return true;

			if(!m) continue;

			int d=p[i].y;

			if(d<=T) {

				d=T-d;

				ax-=d, bx+=d;

				ay-=d, by+=d;

				if(calc(1)) return true;

			}

		}

		else return false;

	}

}

main() {

#ifndef	ONLINE_JUDGE

	freopen("in.in", "r", stdin);

	freopen("out.out", "w", stdout);

#endif

	srand(time(0));

	scanf("%d %d", &n, &m);

	if(n==1) return puts("0");

	for(int i=0, x, y; i<n; i++) {

		scanf("%d %d", &x, &y);

		p[i]=pi3(pii(x-y, x+y), 0);

	}

	for(int i=0, x, y; i<m; i++) {

		::x[i]=x-y;

		::y[i]=x+y;

		id[i]=i;

	}

	if(m) build(1, 0, m);

	for(int i=0, x, y; i<n; i++) {

		x=p[i].x.x, y=p[i].x.y;

		int st=-1, ed=inf;

		while(st+1<ed) {

			int md=st+ed>>1;

			ax=x-md, bx=x+md, ay=y-md, by=y+md;

			if(m && calc(1)) ed=md;

			else st=md;

		}

		p[i].y=ed;

	}

	sort(p, p+n, [](pi3 a, pi3 b) {return a.y>b.y;});

	int st=-1, ed=inf;

	while(st+1<ed) {

		int md=st+ed>>1;

		if(can(md)) ed=md;

		else st=md;

	}

	printf("%d", ed);

}


#include"bits/stdc++.h"
#define inf 0x3f3f3f3f
#define MM 400400
#define NN 100100
#define y second
#define x first

using namespace std;
typedef pair<int, int> pii;
typedef pair<pii, int> pi3;
template<typename A, typename B> inline void smin(A &a, const B &b) {if(a>b) a=b;}
template<typename A, typename B> inline void smax(A &a, const B &b) {if(a<b) a=b;}

int id[NN], LL[MM], RR[MM];
int x[NN], y[NN], xmn[MM], xmx[MM], ymn[MM], ymx[MM];

inline void select(int L, int mid, int R, int *val) {
	R--; int i, j, p, S, X;
	while(L+1<=R) {
		if(L+1==R) {
			if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
			return ;
		}
		S=L+1, X=S+rand()*rand()%(R-L);
		swap(id[L], id[X]);
		if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
		if(val[id[L]]>val[id[S]]) swap(id[L], id[S]);
		if(val[id[S]]>val[id[R]]) swap(id[S], id[R]);
		i=L, j=R, p=val[id[S]];
		while(true) {
			while(i<=R && val[id[i]]<=p) i++;
			while(j>=L && val[id[j]]>=p) j--;
			if(i>j) break; swap(id[i], id[j]);
		}
		if(mid<=j) R=j;
		else if(mid>=i) L=i;
		else break;
	}
}

inline void build(int u, int L, int R, int dp=0) {
	LL[u]=L, RR[u]=R;
	if(L+1==R) {
		xmn[u]=xmx[u]=x[id[L]];
		ymn[u]=ymx[u]=y[id[L]];
		return ;
	}
	int ls=u<<1, rs=ls|1, mid=L+R>>1;

	if(dp) select(L, mid, R, x);
	else select(L, mid, R, y);

	dp^=1;
	build(ls, L, mid, dp);
	build(rs, mid, R, dp);

	xmn[u]=min(xmn[ls], xmn[rs]), xmx[u]=max(xmx[ls], xmx[rs]);
	ymn[u]=min(ymn[ls], ymn[rs]), ymx[u]=max(ymx[ls], ymx[rs]);
}

pi3 p[NN];
int X, Y, mn;

inline bool find(int u) {
	int L=LL[u], R=RR[u];
	if(R-L<=4) {
		for(int i=L; i<R; i++) {
			smin(mn, max(abs(X-x[id[i]]), abs(Y-y[id[i]])));
		}
		return true;
	}
	int ls=u<<1;
	if(find(ls)) return true;
	return find(ls|1);
}

inline void calc(int u) {
	int x_x=0, y_y=0;
	if(X>xmx[u]) x_x=X-xmx[u];
	if(X<xmn[u]) x_x=xmn[u]-X;
	if(Y>ymx[u]) y_y=Y-ymx[u];
	if(Y<ymn[u]) y_y=ymn[u]-Y;
	if(max(x_x, y_y)>mn) return ;
	int L=LL[u], R=RR[u];
	if(L+1==R) {
		smin(mn, max(abs(X-x[id[L]]), abs(Y-y[id[L]])));
		return ;
	}
	int ls=u<<1;
	calc(ls), calc(ls|1);
}

int n, k, ax, ay, bx, by;

inline bool in(int u) {
	if( bx<xmn[u] || xmx[u]<ax  ||  by<ymn[u] || ymx[u]<ay) return false;
	if(ax<=xmn[u] && xmx[u]<=bx && ay<=ymn[u] && ymx[u]<=by) return true;
	if(LL[u]+1==RR[u]) return false;
	int ls=u<<1;
	if(in(ls)) return true;
	return in(ls|1);
}

inline bool can(int d) {
	ax=ay=-inf, bx=by=inf;
	for(int i=1; i<=n; i++) {
		if(ax<=bx && ay<=by) {
			if(k && p[i].y<=d) {
				int T=d-p[i].y;
				ax-=T, ay-=T, bx+=T, by+=T;
				if(in(1)) return true;
				ax+=T, ay+=T, bx-=T, by-=T;
			}
		}
		else return false;
		X=p[i].x.x, Y=p[i].x.y;
		smax(ax, X-d), smin(bx, X+d);
		smax(ay, Y-d), smin(by, Y+d);
	}
	return ax<=bx && ay<=by;
}

main() {
	srand(time(0));

	scanf("%d %d", &n, &k);
	for(int i=1, x, y; i<=n; i++) {
		scanf("%d %d", &x, &y);
		p[i].x={x-y, x+y};
	}
	if(k) {
		for(int i=1, x, y; i<=k; i++) {
			scanf("%d %d", &x, &y);
			::x[i]=x-y, ::y[i]=x+y, id[i]=i;
		}
		build(1, 1, k+1);

		for(int i=1; i<=n; i++) {
			X=p[i].x.x, Y=p[i].x.y;
			mn=max(abs(X-x[1]), abs(Y-y[1]));
			find(1), calc(1);
			p[i].y=mn;
		}
		sort(p+1, p+n+1, [](pi3 a, pi3 b) {return a.y>b.y;});
	}

	int st=-1, ed=200000000;
	while(ed-st>1) {
		int md=st+ed>>1;
		if(can(md)) ed=md;
		else st=md;
	}
	printf("%d", ed);
}


#include<bits/stdc++.h>

#define pb push_back
#define x first
#define y second

using namespace std;

typedef long long INT;
typedef pair<int, int> pii;
using ppi = pair<pii,int>;

const int NN = 100011;
const int MM = 400011;

int id[NN], LL[MM], RR[MM];
int x[NN], y[NN], xmn[MM], xmx[MM], ymn[MM], ymx[MM];
ppi p[NN];
int n, k;
inline void select(int L, int mid, int R, int* val) {
	R--;
	while(L+1<=R) {
		if(L+1==R) {
			if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
			return ;
		}
		int S=L+1, X=S+rand()*rand()%(R-L);
		swap(id[L], id[X]);
		if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
		if(val[id[L]]>val[id[S]]) swap(id[L], id[S]);
		if(val[id[S]]>val[id[R]]) swap(id[S], id[R]);
		int i=L, j=R, p=val[id[S]];
		while(1) {
			while(i<=R && val[id[i]]<=p) i++;
			while(j>=L && val[id[j]]>=p) j--;
			if(i>j) break;
			swap(id[i], id[j]);
		}
		if(mid<=j) R=j;
		else if(mid>=i) L=i;
		else break;
	}
}

inline void build(int u, int L, int R, int dp=0) {
	LL[u]=L, RR[u]=R;
	if(L+1==R) {
		xmn[u]=xmx[u]=x[id[L]];
		ymn[u]=ymx[u]=y[id[L]];
		return ;
	}
	int ls=u<<1, rs=ls|1, mid=L+R>>1;

	if(dp) select(L, mid, R, x);
	else select(L, mid, R, y);

	dp^=1;
	build(ls, L, mid, dp);
	build(rs, mid, R, dp);

	xmn[u]=min(xmn[ls], xmn[rs]), xmx[u]=max(xmx[ls], xmx[rs]);
	ymn[u]=min(ymn[ls], ymn[rs]), ymx[u]=max(ymx[ls], ymx[rs]);
}
int xx, xy, yx, yy;
#define ls (u<<1)
#define rs (ls|1)

inline bool calc(int u) {
	if(xmn[u]>yx || xmx[u]<xx || ymn[u]>yy || ymx[u]<xy) return false;
	if(xx<=xmn[u] && xmx[u]<=yx && xy<=ymn[u] && ymx[u]<=yy) return true;
	if(LL[u]+1==RR[u]) return false;
	return calc(ls) ? true : calc(rs);
}

inline void smax(int &u, int v) {if(u<v) u = v;}
inline void smin(int &u, int v) {if(u>v) u = v;}

inline int ok(int mid) {
	xx = xy = -1e9;
	yx = yy = 1e9;
	for(int i=0; i<n; i++) {
		if(xx <= yx and xy <= yy) {
			if(k and p[i].y <= mid) {
				int r = mid - p[i].y;
				xx -= r; xy -= r;
				yx += r; yy += r;
				if(calc(1)) return true;
				xx += r; xy += r;
				yx -= r; yy -= r;
			}
		}
		else return false;
		smax(xx, p[i].x.x-mid);
		smin(yx, p[i].x.x+mid);
		smax(xy, p[i].x.y-mid);
		smin(yy, p[i].x.y+mid);
	}
	return xx<=yx and xy<=yy;
}

int solve() {
	cin >> n >> k;
	if(n == 1) return puts("0");
	for(int i=0; i<n; i++) {
		int x, y;
		scanf("%d %d", &x, &y);
		p[i].x.x = x + y;
		p[i].x.y = x - y;
	}
    for(int i=0; i<k; i++) {
		int x, y;
		scanf("%d %d", &x, &y);
		::x[i] = x + y;
		::y[i] = x - y;
		id[i] = i;
	}

	if(k) {
		build(1, 0, k);
		for(int i=0; i<n; i++) {
			int st = -1, ed = 1e9;
			while(ed > st + 1) {
				int mid = st + ed >> 1;
				xx = p[i].x.x - mid; xy = p[i].x.y - mid;
				yx = p[i].x.x + mid; yy = p[i].x.y + mid;
                if(calc(1)) ed = mid;
                else st = mid;
			}
			p[i].y = ed;
		}
	}
	sort(p, p+n, [&](ppi u, ppi v) {return u.y > v.y;});
	int st = -1, ed = 1e9;
	while(ed > st + 1) {
		int mid = st + ed >> 1;
        if(ok(mid)) ed = mid;
        else st = mid;
	}
	cout << ed << endl;
}

int main() {
#ifndef	ONLINE_JUDGE
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
#endif
	srand(time(0));
	solve();
	return 0;
}


#include"bits/stdc++.h"
#define inf 0x3f3f3f3f
#define MM 400400
#define NN 100100
#define y second
#define x first

using namespace std;
typedef pair<int, int> pii;
typedef pair<pii, int> pi3;
template<typename A, typename B> inline void smin(A &a, const B &b) {if(a>b) a=b;}
template<typename A, typename B> inline void smax(A &a, const B &b) {if(a<b) a=b;}

int id[NN], LL[MM], RR[MM];
int x[NN], y[NN], xmn[MM], xmx[MM], ymn[MM], ymx[MM];

inline void select(int L, int mid, int R, int *val) {
	R--; int i, j, p, S, X;
	while(L+1<=R) {
		if(L+1==R) {
			if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
			return ;
		}
		S=L+1, X=S+rand()*rand()%(R-L);
		swap(id[L], id[X]);
		if(val[id[L]]>val[id[R]]) swap(id[L], id[R]);
		if(val[id[L]]>val[id[S]]) swap(id[L], id[S]);
		if(val[id[S]]>val[id[R]]) swap(id[S], id[R]);
		i=L, j=R, p=val[id[S]];
		while(true) {
			while(i<=R && val[id[i]]<=p) i++;
			while(j>=L && val[id[j]]>=p) j--;
			if(i>j) break; swap(id[i], id[j]);
		}
		if(mid<=j) R=j;
		else if(mid>=i) L=i;
		else break;
	}
}

inline void build(int u, int L, int R, int dp=0) {
	LL[u]=L, RR[u]=R;
	if(L+1==R) {
		xmn[u]=xmx[u]=x[id[L]];
		ymn[u]=ymx[u]=y[id[L]];
		return ;
	}
	int ls=u<<1, rs=ls|1, mid=L+R>>1;

	if(dp) select(L, mid, R, x);
	else select(L, mid, R, y);

	dp^=1;
	build(ls, L, mid, dp);
	build(rs, mid, R, dp);

	xmn[u]=min(xmn[ls], xmn[rs]), xmx[u]=max(xmx[ls], xmx[rs]);
	ymn[u]=min(ymn[ls], ymn[rs]), ymx[u]=max(ymx[ls], ymx[rs]);
}

pi3 p[NN];
int X, Y, mn;

inline bool find(int u) {
	int L=LL[u], R=RR[u];
	if(R-L<=4) {
		for(int i=L; i<R; i++) {
			smin(mn, max(abs(X-x[id[i]]), abs(Y-y[id[i]])));
		}
		return true;
	}
	int ls=u<<1;
	if(!find(ls)) return find(ls|1);
	return true;
}

inline void calc(int u) {
	int x_x=0, y_y=0;
	if(X>xmx[u]) x_x=X-xmx[u];
	if(X<xmn[u]) x_x=xmn[u]-X;
	if(Y>ymx[u]) y_y=Y-ymx[u];
	if(Y<ymn[u]) y_y=ymn[u]-Y;
	if(max(x_x, y_y)>mn) return ;
	int L=LL[u], R=RR[u];
	if(L+1==R) {
		smin(mn, max(abs(X-x[id[L]]), abs(Y-y[id[L]])));
		return ;
	}
	int ls=u<<1;
	calc(ls), calc(ls|1);
}

int n, k, ax, ay, bx, by;

inline bool in(int u) {
	if(xmx[u]<ax || xmn[u]>bx) return false;
	if(ymx[u]<ay || ymn[u]>by) return false;
	if(xmn[u]<=ax && bx<=xmx[u] && ymn[u]<=ay && by<=ymx[u]) return true;
	if(LL[u]+1==RR[u]) return false;
	int ls=u<<1;
	if(!in(ls)) return in(ls|1);
	return true;
}

inline bool can(int d) {
	int Xmn=-inf, Ymn=-inf, Xmx=inf, Ymx=inf, id=1;
	for(; id<=n && p[id].y>d; id++) {
		smax(Xmn, p[id].x.x-d); smin(Xmx, p[id].x.x+d);
		smax(Ymn, p[id].x.y-d); smin(Ymx, p[id].x.y+d);
		if(Xmn>Xmx || Ymn>Ymx) return false;
	}
	for(; id<=n; id++) {
		int len=d-p[id+1].y;
		ax=Xmn-len, ay=Ymn-len, bx=Xmx+len, by=Ymx+len;
		if(in(1)) return true;
		smax(Xmn, p[id].x.x-d); smin(Xmx, p[id].x.x+d);
		smax(Ymn, p[id].x.y-d); smin(Ymx, p[id].x.y+d);
		if(Xmn>Xmx || Ymn>Ymx) return false;
	}
	return true;
}

main() {
	srand(time(0));

	scanf("%d %d", &n, &k);
	for(int i=1, x, y; i<=n; i++) {
		scanf("%d %d", &x, &y);
		p[i].x={x-y, x+y};
	}
	if(k) {
		for(int i=1, x, y; i<=k; i++) {
			scanf("%d %d", &x, &y);
			::x[i]=x-y, ::y[i]=x+y;
		}
		build(1, 1, k+1);
		for(int i=1; i<=n; i++) {
			mn=inf;
			X=p[i].x.x, Y=p[i].x.y;
			find(1), calc(1);
			p[i].y=mn;
		}
		sort(p+1, p+n+1, [](pi3 a, pi3 b) {return a.y>b.y;});
	}

	int st=-1, ed=200000000;
	while(ed-st>1) {
		int md=st+ed>>1;
		if(can(md)) ed=md;
		else st=md;
	}
	printf("%d", ed);
}