#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#define MAXN 1000010
#define MAX (1LL<<30)
#define Alpha 0.75
using namespace std;
int n,m,root,ans,size=0;
int top=0,recycle[MAXN];
bool sort_flag=false;
struct Point{
int x,y;
friend bool operator <(const Point &p,const Point &q){
if(sort_flag)return p.y<q.y;
return p.x<q.x;
}
}point[MAXN],now;
struct Tree{
Point point;
int minx,miny,maxx,maxy,lson,rson,size;
}a[MAXN];
inline int read(){
int date=0,w=1;char c=0;
while(c<'0'||c>'9'){if(c=='-')w=-1;c=getchar();}
while(c>='0'&&c<='9'){date=date*10+c-'0';c=getchar();}
return date*w;
}
inline int get_dis(const Point &p,const Point &q){
return abs(p.x-q.x)+abs(p.y-q.y);
}
inline int newnode(const Point &p){
int rt;
if(top)rt=recycle[top--];
else rt=++size;
a[rt].point=p;
a[rt].maxx=a[rt].minx=p.x;
a[rt].maxy=a[rt].miny=p.y;
a[rt].lson=a[rt].rson=0;
a[rt].size=1;
return rt;
}
inline void pushup(int rt){
int lson=a[rt].lson,rson=a[rt].rson;
a[rt].size=a[lson].size+a[rson].size+1;
a[rt].maxx=max(a[rt].maxx,max(a[lson].maxx,a[rson].maxx));
a[rt].maxy=max(a[rt].maxy,max(a[lson].maxy,a[rson].maxy));
a[rt].minx=min(a[rt].minx,min(a[lson].minx,a[rson].minx));
a[rt].miny=min(a[rt].miny,min(a[lson].miny,a[rson].miny));
}
void buildtree(int l,int r,int &rt,int flag){
int mid=l+r>>1;
sort_flag=flag;
nth_element(point+l,point+mid,point+r+1);
rt=newnode(point[mid]);
if(l<mid)buildtree(l,mid-1,a[rt].lson,flag^1);
if(mid<r)buildtree(mid+1,r,a[rt].rson,flag^1);
pushup(rt);
}
void pia(int rt,int num){
if(a[rt].lson)pia(a[rt].lson,num);
point[num+a[a[rt].lson].size+1]=a[rt].point;
recycle[++top]=rt;
if(a[rt].rson)pia(a[rt].rson,num+a[a[rt].lson].size+1);
}
void check(int &rt,int flag){
if(Alpha*a[rt].size<max(a[a[rt].lson].size,a[a[rt].rson].size)){
pia(rt,0);
buildtree(1,a[rt].size,rt,flag);
}
}
void insert(int &rt,int flag){
if(!rt){
rt=newnode(now);
return;
}
sort_flag=flag;
if(a[rt].point<now)insert(a[rt].rson,flag^1);
else insert(a[rt].lson,flag^1);
pushup(rt);
check(rt,flag);
}
inline int max_dis(int rt){
int x,y;
x=max(now.x-a[rt].maxx,0)+max(a[rt].minx-now.x,0);
y=max(now.y-a[rt].maxy,0)+max(a[rt].miny-now.y,0);
return x+y;
}
void query(int rt){
int dis=get_dis(a[rt].point,now),ldis=MAX,rdis=MAX;
ans=min(ans,dis);
if(a[rt].lson)ldis=max_dis(a[rt].lson);
if(a[rt].rson)rdis=max_dis(a[rt].rson);
if(ldis<rdis){
if(ldis<ans)query(a[rt].lson);
if(rdis<ans)query(a[rt].rson);
}
else{
if(rdis<ans)query(a[rt].rson);
if(ldis<ans)query(a[rt].lson);
}
}
void work(){
int f;
while(m--){
f=read();now.x=read();now.y=read();
if(f==1)insert(root,0);
else{
ans=MAX;
query(root);
printf("%d\n",ans);
}
}
}
void init(){
n=read();m=read();
a[0].maxx=a[0].maxy=-MAX;
a[0].minx=a[0].miny=MAX;
for(int i=1;i<=n;i++){point[i].x=read();point[i].y=read();}
buildtree(1,n,root,0);
}
int main(){
init();
work();
return 0;
}