#include "bits/stdc++.h"
using namespace std;


#define Seg_Max_N (1<<20) 


using Value = int;
const Value ini = 0;
struct segtree {
	int N;
	vector<Value>dat;

	segtree() {}
	segtree(int n) :dat(2 * Seg_Max_N) {
		N = 1;
		while (N < n) N *= 2;
		for (int i = 0; i < 2 * N - 1; i++) {
			dat[i] = ini;
		}
	}
	Value connect(const Value&l, const Value&r) {
		return l + r;

	}
	// update k th element
	void update(int k, Value a) {
		k += N - 1;
		dat[k] = a;

		while (k > 0) {
			k = (k - 1) / 2;
			const Value al(dat[k * 2 + 1]);
			const Value ar(dat[k * 2 + 2]);
			dat[k] = connect(al, ar);
		}
	}
	// min [a, b)
	Value  query(int a, int b) { return query(a, b, 0, 0, N); }
	Value  query(int a, int b, int k, int l, int r) {
		if (r <= a or b <= l) return ini;
		if (a <= l and r <= b) return dat[k];
		const int m = (l + r) / 2;
		const Value al(query(a, b, k * 2 + 1, l, m));
		const Value ar(query(a, b, k * 2 + 2, m, r));
		return connect(al, ar);
	}
};

struct query {
	int command;
	long long int a;
	long long int b;
};

template<typename T> struct Compress {
	map<T, int>mp;
	map<int, T>revmp;

	Compress(vector<T>vs) {
		setmp(vs);
	}

	Compress() :mp(), revmp() {

	}
	void setmp(vector<T>vs) {
		sort(vs.begin(), vs.end());
		vs.erase(unique(vs.begin(), vs.end()), vs.end());
		for (int i = 0; i < static_cast<int>(vs.size()); ++i) {
			mp[vs[i]] = i;
			revmp[i] = vs[i];
		}
	}

};

int main() {
	int N, C; cin >> N >> C;
	vector<query>qs;
	Compress<pair<long long int, int>>cp;
	{
		
		vector<pair<long long int, int>>vs;
		for (int i = 0; i < N; ++i) {
			vs.push_back(make_pair(0, -i));
		}
		vector<long long int>v(N);
		for (int i = 0; i < C; ++i) {
			int command; cin >> command;
			if (command) {
				int m; cin >> m;
				qs.push_back(query{ command,m,-1 });
			}
			else {
				int t, p; cin >> t >> p;
				t--;
				v[t] += p;
				vs.push_back(make_pair(v[t], -t));
				qs.push_back(query{ command,t,p });
			}
		}
		cp.setmp(vs);
	}
	segtree seg(N+C+10);
	vector<long long int >scores(N);
	for (int i = 0; i < N; ++i) {
		seg.update(cp.mp[make_pair(0, -i)], 1);
	}
	for (int i = 0; i < C; ++i) {
		auto query(qs[i]);
		const int command(query.command);
		if (command == 0) {
			const long long int t(query.a);
			const int p(query.b);
			seg.update(cp.mp[make_pair(scores[t], -t)], 0);
			seg.update(cp.mp[make_pair(scores[t] + p,-t)], 1);
			scores[t] += p;
		}
		else {
			const long long int m(query.a);

			int amin = 0;
			int amax = 3e5;
			while (amin + 1 != amax) {
				int amid((amin + amax) / 2);
				int num = seg.query(0, amid);
				if (num >= N-m+1)amax = amid;
				else amin = amid;
			}
			auto p(cp.revmp[amin]);
			cout << -p.second+1 << " " << p.first << endl;

		}
	}
	
	return 0;
}