#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,a) for(int i=0;i<(a);++i)
#define MP make_pair
#define INF 1e9
#define F first
#define S second
#define MAX_N 100000
using namespace std;
typedef long long LL;
typedef pair<LL, int> P;
int N, C;
int in[MAX_N][3];
vector<LL> BIT, pt;
vector<vector<LL> > pts;
vector< vector<LL>::iterator > ite;
vector<P> cond; // condition
int sum(int i)
{
	int s = 0;
	while(i > 0)
	{
		s += BIT[i];
		i -= i & -i;
	}
	return s;
}
void add(int i, int x)
{
	while(i < BIT.size())
	{
		BIT[i] += x;
		i += i & -i;
	}
}
bool comp(const P& a, const P& b){
		return a.first == b.first ? a.second > b.second : a.first < b.first;
}
int main()
{
	cin >> N >> C;
	pt.resize(N);
	pts.resize(N);
	ite.resize(N);
	REP(i, N)
	{
		cond.push_back(MP(0, i));
	}
	REP(i, C)
	{
		cin >> in[i][0];
		if(!in[i][0])
		{
			cin >> in[i][1] >> in[i][2];
			--in[i][1];
			pt[in[i][1]] += in[i][2];
			cond.push_back(MP(pt[in[i][1]], in[i][1]));
		}
		else
		{
			cin >> in[i][1];
		}
	}
	sort(cond.begin(), cond.end(), comp);
	REP(i, cond.size())
	{
		pts[cond[i].S].push_back(i);
	}
	REP(i, N)
	{
		ite[i] = pts[i].begin();
	}
	BIT.resize(cond.size() + 1);
	FOR(i, 1, N + 1)
	{
		add(i, 1);
	}
	
	REP(i, C)
	{
		if(!in[i][0])
		{
			add(*ite[in[i][1]] + 1, -1);
			++ite[in[i][1]];
			add(*ite[in[i][1]] + 1, 1);
	
		}
		else
		{
			int s = 1, e = cond.size(), mid;
			while(s < e)
			{
				mid = (s + e) / 2;
				sum(mid) < N - in[i][1] + 1 ? s = mid + 1 : e = mid; 
			}
			cout << cond[s - 1].S + 1 << " " << cond[s - 1].F << endl;
		}
	}
	return 0;
}