#include
#include
#include
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<long long, null_type, less, rb_tree_tag,
tree_order_statistics_node_update>
PBDS;
int main()
{
PBDS v;
long long q;
cin >> q;
long long k;
cin >> k;
int Q ;
long long x, y;
long long S;
for (int i = 0; i < q; i++)
{
cin >> Q;
if (Q == 1)
{
cin >> x >> y;
S = (x * x) + (y * y);
v.insert(S);
}
if (Q == 2)
{
cout << *v.find_by_order(k - 1) << endl;
}
}
return 0;
}