#define PROBLEM "http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0343"

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

#define call_from_test
#ifndef call_from_test
#include<bits/stdc++.h>
using namespace std;
#endif
//BEGIN CUT HERE
template<typename V>
V compress(V v){
  sort(v.begin(),v.end());
  v.erase(unique(v.begin(),v.end()),v.end());
  return v;
}
template<typename T>
map<T, int> dict(const vector<T> &v){
  map<T, int> res;
  for(int i=0;i<(int)v.size();i++)
    res[v[i]]=i;
  return res;
}
map<char, int> dict(const string &v){
  return dict(vector<char>(v.begin(),v.end()));
}
//END CUT HERE
#ifndef call_from_test
//INSERT ABOVE HERE
signed main(){
  return 0;
}
#endif

#ifndef call_from_test
#include<bits/stdc++.h>
using namespace std;
#endif
//BEGIN CUT HERE
template<typename T>
struct BIT{
  int n;
  vector<T> bit;
  // 1-indexed
  BIT(int n_):n(n_+1),bit(n+1,0){}

  T sum(int i){
    T s(0);
    for(int x=i;x>0;x-=(x&-x))
      s+=bit[x];
    return s;
  }

  void add(int i,T a){
    if(i==0) return;
    for(int x=i;x<=n;x+=(x&-x))
      bit[x]+=a;
  }

  // [l, r)
  T query(int l,int r){
    return sum(r-1)-sum(l-1);
  }

  int lower_bound(int w){
    if(w<=0) return 0;
    int x=0,r=1;
    while(r<n) r<<=1;
    for(int k=r;k>0;k>>=1){
      if(x+k<=n&&bit[x+k]<w){
        w-=bit[x+k];
        x+=k;
      }
    }
    return x+1;
  }

  // 0-indexed
  T sum0(int i){return sum(i+1);}
  void add0(int i,T a){add(i+1,a);}
  T query0(int l,int r){return sum(r)-sum(l);}
};
//END CUT HERE
#ifndef call_from_test
signed main(){
  return 0;
}
#endif

#undef call_from_test

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);

  using ll = long long;

  int n,c;
  cin>>n>>c;
  vector<int> ts(c),is(c),ps(c);
  for(int i=0;i<c;i++){
    cin>>ts[i]>>is[i];
    if(ts[i]==0) cin>>ps[i],is[i]--;
  }

  vector<ll> ss(n,0);

  using P = pair<ll, int>;
  vector<P> vp;
  for(int i=0;i<n;i++) vp.emplace_back(-ss[i],i);

  for(int i=0;i<c;i++){
    if(ts[i]==0){
      ss[is[i]]+=ps[i];
      vp.emplace_back(-ss[is[i]],is[i]);
    }
  }
  vp.emplace_back(-ll(1e18),0);
  vp=compress(vp);
  auto dc=dict(vp);

  BIT<int> bit(vp.size());

  fill(ss.begin(),ss.end(),0);
  for(int i=0;i<n;i++) bit.add(dc[P(-ss[i],i)],+1);

  for(int i=0;i<c;i++){
    if(ts[i]==0){
      bit.add(dc[P(-ss[is[i]],is[i])],-1);
      ss[is[i]]+=ps[i];
      bit.add(dc[P(-ss[is[i]],is[i])],+1);
    }
    if(ts[i]==1){
      int k=bit.lower_bound(is[i]);
      cout<<vp[k].second+1<<" "<<-vp[k].first<<"\n";
    }
  }
  return 0;
}

