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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define FF first
#define SS second

#define DUMP(x) cout<<#x<<":"<<(x)<<endl
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class T>
istream& operator>>(istream& is, vector<T>& xs){
  for(auto& x: xs)
	is >> x;
  return is;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
ostream& operator<<(ostream& os, const vector<T>& xs){
  for(unsigned int i=0;i<xs.size();++i)
	os << (i?" ":"") << xs[i];
  return os;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;


typedef PLL Key;
typedef int Value;
struct Treap{
  Key key;
  Value value;
  int p;
  int cnt;
  Treap* ch[2]; // 0: left, 1: right
  Treap(const Key& key_, const Value& value_):
	key(key_), value(value_), p(rand()), cnt(1)
  {
	ch[0] = ch[1] = 0;
  }
};
int count(Treap* t){
  return (t==0?0:t->cnt);
}

Treap* upc(Treap* t){
  if(!t) return t;
  
  t->cnt = count(t->ch[0]) + count(t->ch[1]) + 1;
  return t;
}

// 0-indexed
pair<Key,Value> nth(Treap* t, int k){
  if(k == count(t->ch[0]))
	return MP(t->key, t->value);
  if(k < count(t->ch[0]))
	return nth(t->ch[0], k);
  return nth(t->ch[1], k - count(t->ch[0]) - 1);
}

Treap* rotate(Treap* t, int b){ // b==0: left, b==1: right rotate
  Treap *s = t->ch[1-b];
  t->ch[1-b] = s->ch[b];
  s->ch[b] = t;

  upc(t);
  return upc(s);
}

Treap* find(Treap* t, const Key& key){
  if(!t) return t;
  return (!t || key == t->key)? t: find(t->ch[key > t->key], key);
}

Treap* insert(Treap* t, const Key& key, const Value& value){
  if(!t) return new Treap(key, value);
  if(key == t->key) return t;

  int b = key > t->key;
  t->ch[b] = insert(t->ch[b], key, value);
  if(t->p > t->ch[b]->p) t = rotate(t, 1-b);
  return upc(t);
};

Treap* erase(Treap* t, const Key& key){
  if(!t) return 0;
  if(t->key == key){
	if(!t->ch[0] && !t->ch[1]) return 0;
	if(!t->ch[0]) t = rotate(t, 0);
	else if(!t->ch[1]) t = rotate(t, 1);
	else t = rotate(t, t->ch[0]->p < t->ch[1]->p);

	t = erase(t, key);
  }
  else{
	int b = key >= t->key;
	t->ch[b] = erase(t->ch[b], key);
  }
  return upc(t);
}
 
 void debug(Treap* t, string s = ""){
  if(t->ch[0])
	debug(t->ch[0], s+"L");
  cout << s << " " << t->key << endl;
  if(t->ch[1])
	debug(t->ch[1], s+"R");
}


int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N, C;
  cin >> N >> C;
  Treap* t = nullptr;
  REP(i,N) t = insert(t, MP(0, -i-1), 0);

  VL score(N+1);
  REP(i,C){
	int ty;
	cin >> ty;
	if(ty == 0){
	  int tt, p;
	  cin >> tt >> p;
	  t = erase(t, MP(score[tt], -tt));
	  score[tt] += p;
	  t = insert(t, MP(score[tt], -tt), 0);
	}
	else{
	  int m;
	  cin >> m;
	  PLL res = nth(t, N-m).FF;
	  cout << -res.SS << " " << res.FF << endl;
	}
  }

  return 0;
}

