#include<iostream>
#include<memory>
#include<random>

using Size = int;

template<typename Key, typename Value> class RandomizedBinarySearchTree {
 public:
  // ??????
  void insert(const Key& key, const Value& value) {
    auto i = index(root_, key);
    auto s = split(root_, i);
    auto n = std::make_unique<Node>(key, value);
    root_ = merge(s.first, n);
    root_ = merge(root_, s.second);
  }
  // ??????
  void erase(const Key& key) {
    auto i = index(root_, key);
    auto s1 = split(root_, i);
    auto s2 = split(s1.second, 1);
    root_ = merge(s1.first, s2.second);
  }
  // ????´¢
  std::pair<Key, Value> find(const Size& i) const {return find(root_, i);}
  // ???????????°??¨
  void debug() {traverse(root_,0);}
  void traverse(const auto& node, auto d)const{
    if(!node) return;
    traverse(node->r_child,d+1);
    for(auto i=0;i<d;++i)std::cout<<"    ";
    std::cout<<"_"<<node->value;
    std::cout<<"_"<<node->key;
    std::cout<<std::endl;
    traverse(node->l_child,d+1);
  }

 private:
  // ??????
  struct Node {
    Key key;
    Value value;
    Size size;
    std::unique_ptr<Node> l_child, r_child;
    Node(const Key& k, const Value& v) : key(k), value(v), size(1) {}
  };
  // ?????????????????????
  using Ptr = std::unique_ptr<Node>;

  // ??¨?????¨???????????????????????°
  Size size(const Ptr& node) const {return node ? node->size : 0;}
  // ??????????????±??????????????±????????¨?????´??°
  Ptr update(Ptr& node) {
    if(!node) return std::move(node);
    node->size = size(node->l_child) + size(node->r_child) + 1;
    return std::move(node);
  }
  // key ?????? index ???????´¢
  Size index(const Ptr& node, const Key& key) const {
    if(!node) return 0;
    if(node->key == key) return size(node->l_child);
    if(key < node->key)  return index(node->l_child, key);
    else                 return size(node->l_child) + 1 + index(node->r_child, key);
  }
  // index ?????? key, value ???????´¢
  std::pair<Key, Value> find(const Ptr& node, const Size& i) const {
    if(size(node->l_child) == i) return std::make_pair(node->key, node->value);
    if(i < size(node->l_child))  return find(node->l_child, i);
    else                         return find(node->r_child, i - size(node->l_child) - 1);
  }
  // ??¨?????????
  Ptr merge(Ptr& lhs, Ptr& rhs) {
    if(!lhs) return std::move(rhs);
    if(!rhs) return std::move(lhs);
    auto to_left = std::random_device()() % (size(lhs) + size(rhs)) < size(lhs);
    if(to_left) {
      lhs->r_child = merge(lhs->r_child, rhs);
      return update(lhs);
    } else {
      rhs->l_child = merge(lhs, rhs->l_child);
      return update(rhs);
    }
  }
  // key ????°????????????? i ?????????????????¨??¨, ????????\?????????????????¨??¨?????????
  std::pair<Ptr, Ptr> split(Ptr& node, const Size& i) {
    if(!node) return std::make_pair(nullptr, nullptr);
    if(i <= size(node->l_child)) {
      auto s = split(node->l_child, i);
      node->l_child = std::move(s.second);
      return std::make_pair(std::move(s.first), update(node));
    } else {
      auto s = split(node->r_child, i - size(node->l_child) - 1);
      node->r_child = std::move(s.first);
      return std::make_pair(update(node), std::move(s.second));
    }
  }

  // ?????°
  Ptr root_;
};

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

using LL = long long;

const LL P = 100'000;

int main() {
  int N, C;
  cin >> N >> C;

  vector<LL> score(N + 1);
  for(auto i = 1; i <= N; ++i) score[i] = N - i;

  RandomizedBinarySearchTree<LL, int> RBST;
  for(auto i = 1; i <= N; ++i) RBST.insert(score[i], i);

// RBST.debug();cout<<endl;
  for(auto i = 0; i < C; ++i) {
    int c;
    cin >> c;

    if(!c) {
      LL t, p;
      cin >> t >> p;

      RBST.erase(score[t]);
      score[t] += p * P;
      RBST.insert(score[t], t);
    }

    if(c) {
      LL m;
      cin >> m;

      auto res = RBST.find(N - m);
      cout << res.second << " " << res.first / P << endl;
    }
// RBST.debug();cout<<endl;
  }
}

Measured memory_bytes: 8456