while(q–)
{
int a,x,y;
cin>>a;
if(a==1)
{
cin>>x>>y;
pq.push((xx)+(yy));
if(pq.size()>k)
{
pq.pop();
}
}
if(a==2)
{
cout<<pq.top()<<"\n";
}
}
while(q–)
{
int a,x,y;
cin>>a;
if(a==1)
{
cin>>x>>y;
pq.push((xx)+(yy));
if(pq.size()>k)
{
pq.pop();
}
}
if(a==2)
{
cout<<pq.top()<<"\n";
}
}