#include
#include
#include
using namespace std;
int main() {
priority_queuepq;
int q,k;
cin>>q>>k;
int count=1;
while(q–){
int a;
cin>>a;
if(a==1){
int p,q;
cin>>p>>q;
if(count>3){
if(p*p+q*q >pq.top()){
count++;
continue;
}
else{
pq.pop();
pq.push(p*p + q*q);
}
}
else{
pq.push(p*p + q*q);
}
count++;
}
else{
cout<<pq.top()<<endl;
}
}
return 0;
}