#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <map>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

struct Info{
	Info(int arg_team_id,ll arg_total_score){
		team_id = arg_team_id;
		total_score = arg_total_score;
	}
	bool operator<(const struct Info &arg) const{
		if(total_score != arg.total_score){
			return total_score > arg.total_score;
		}else{
			return team_id < arg.team_id;
		}
	};

	int team_id;
	ll total_score;
};

int N,size_BIT;
int* BIT;

void add(int loc,int value){

	BIT[loc] += value;

	loc += loc & -loc;

	while(loc <= size_BIT){
		BIT[loc] += value;
		loc += loc & -loc;
	}
}

int getSum(int loc){

	int sum = BIT[loc];

	loc -= loc & -loc;

	while(loc > 0){
		sum += BIT[loc];
		loc -= loc & -loc;
	}
	return sum;
}


int main(){

	int num_order;
	scanf("%d %d",&N,&num_order);

	ll* sum = new ll[N+1];

	for(int i = 1; i <= N; i++){
		sum[i] = 0;
	}

	int* order = new int[num_order];
	int* target = new int[num_order];
	ll* diff = new ll[num_order];

	priority_queue<Info> Q;

	for(int team = 1; team <= N; team++){
		Q.push(Info(team,0));
	}

	for(int i = 0; i < num_order; i++){

		scanf("%d %d",&order[i],&target[i]);
		if(order[i] == 0){
			scanf("%lld",&diff[i]);
			sum[target[i]] += diff[i];
			Q.push(Info(target[i],sum[target[i]]));
		}
	}

	vector<Info> V;

	while(!Q.empty()){
		V.push_back(Q.top());
		Q.pop();
	}

	size_BIT = V.size();
	BIT = new int[size_BIT+1];

	for(int i = 1; i <= size_BIT; i++){
		BIT[i] = 0;
	}

	for(int loc = 1; loc <= N; loc++){
		add(loc,1);
	}

	for(int i = 1; i <= N; i++)sum[i] = 0;

	int left,right,m,pre_loc,next_loc,target_id,search_order,tmp,min_index;

	for(int loop = 0; loop < num_order; loop++){

		if(order[loop] == 0){

			target_id = target[loop];

			left = 0,right = V.size()-1,m = (left+right)/2;

			while(left <= right){

				if(V[m].total_score == sum[target_id]){
					if(V[m].team_id == target_id){
						pre_loc = m;
						break;
					}else{
						if(V[m].team_id > target_id){
							left = m+1;
						}else{
							right = m-1;
						}
					}
				}else if(V[m].total_score > sum[target_id]){
					right = m-1;
				}else{
					left = m+1;
				}
				m = (left+right)/2;
			}

			add(pre_loc+1,-1);

			sum[target_id] += diff[loop];

			left = 0,right = V.size()-1,m = (left+right)/2;

			while(left <= right){

				if(V[m].total_score == sum[target_id]){
					if(V[m].team_id == target_id){
						next_loc = m;
						break;
					}else{
						if(V[m].team_id > target_id){
							left = m+1;
						}else{
							right = m-1;
						}
					}
				}else if(V[m].total_score > sum[target_id]){
					right = m-1;
				}else{
					left = m+1;
				}
				m = (left+right)/2;
			}

			add(next_loc+1,1);

		}else{

			search_order = target[loop];

			left = 1,right = V.size(),m = (left+right)/2;
			min_index = V.size();

			while(left <= right){

				tmp = getSum(m);

				if(tmp == (N-search_order+1)){
					min_index = m;
					right = m-1;
				}else if(tmp > (N-search_order+1)){
					right = m-1;
				}else{
					left = m+1;
				}
				m = (left+right)/2;
			}
			printf("%d %lld\n",V[min_index-1].team_id,V[min_index-1].total_score);
		}
	}

	return 0;
}

Measured memory_bytes: 14312