#include<iostream>
#include<vector>

//AVLTree.hpp
#include <algorithm>
#include <type_traits>
#include <memory>

template<typename T>
using RawPointer = T*;

namespace detail {
	template<typename T>
	struct parent {
		using type = T;
	};
	template<typename T>
	struct parent<T*> {
		class type {
			T* f;
		public:
			type(T* t) noexcept : f{t} {}
			type(const type&) = default;
			type(type&&) = default;
			template<typename U, typename V>
			bool operator()(const U& lhs, const V& rhs) const {return (*f)(lhs, rhs);}
		};
	};
	struct less {
		constexpr less() = default;
		template<typename T, typename U>
		bool operator()(const T& t, const U& u) const {return std::forward<T>(t) < std::forward<U>(u);}
	};
}

template<template<class> class MemoryManager = std::shared_ptr>
class Avl {
	class Util {
		template<typename T>struct MakeResourceImpl;
		template<typename T>
		struct MakeResourceImpl<T*>{
			template<typename... Args>
			static T* make(Args&&... args) {
				return new T{std::forward<Args>(args)...};
			}
		};
		template<typename T>
		struct MakeResourceImpl<std::shared_ptr<T>>{
			template<typename... Args>
			static std::shared_ptr<T> make(Args&&... args) {
				return std::make_shared<T>(std::forward<Args>(args)...);
			}
		};
	public:
		template<typename T, typename... Args>
		static T makeResource(Args&&... args) {
			return MakeResourceImpl<T>::make(std::forward<Args>(args)...);
		}
	};
public:
	struct Node {
		template<typename T>
		struct One {
			T key;
			int size, height;
			MemoryManager<One> child[2];

			using key_type = T;

			explicit One(const T &key) : key(key), size(1), height(1), child{nullptr, nullptr} {}
			One(One&&) = default;
			One(const One&) = default;
			One& operator = (const One&) = default;
			One& operator = (One&&) = default;
		};

		template<typename S, typename T>
		struct Pair {
			S key;
			T val;
			int size, height;
			MemoryManager<Pair> child[2];

			using key_type = T;

			Pair(const S &key, const T& val) : key(key), val(val), size(1), height(1), child{nullptr, nullptr} {}
			Pair(Pair&&) = default;
			Pair(const Pair&) = default;
			Pair& operator = (const Pair&) = default;
			Pair& operator = (Pair&&) = default;
		};

		template<typename S, typename T>
		auto MakePair(const S& key, const T& val) -> Pair<typename std::decay<S>::type, typename std::decay<T>::type> {
			return {key, val};
		}
	};

	template <typename Node, typename Compare = detail::less>
	class Tree : detail::parent<std::decay_t<Compare>>::type {
		using comp_type = typename detail::parent<std::decay_t<Compare>>::type;
		// Variable
		MemoryManager<Node> root;

		// Functions
		static int node_size_or(const MemoryManager<Node>& n) {
			return n ? n->size : 0;
		}
		static int node_height_or(const MemoryManager<Node>& n) {
			return n ? n->height : 0;
		}

		template<typename T>
		MemoryManager<Node> find_impl(const MemoryManager<Node>& t, const T& key) const {
			if (t == nullptr)
				return nullptr;
			if (!(*this)(t->key, key) && !(*this)(key, t->key))
				return t;

			const int idx = (*this)(key, t->key) ? 0 : 1;
			return find_impl(t->child[idx], key);
		}

		MemoryManager<Node> insert_impl(MemoryManager<Node>& t, const MemoryManager<Node>& x) {
			if (t == nullptr)
				return x;

			const int idx = (*this)(t->key, x->key) ? 1 : 0;
			t->child[idx] = insert_impl(t->child[idx], x);
			t->size += 1;

			return balance(t);
		}

		template<typename T>
		MemoryManager<Node> erase_impl(MemoryManager<Node>& t, const T& x) {
			if (t == nullptr)
				return nullptr;
			if (!(*this)(t->key, x) && !(*this)(x, t->key))
				return move_down(t->child[0], t->child[1]);

			const auto idx = (*this)(x, t->key) ? 0 : 1;
			t->child[idx] = erase_impl(t->child[idx], x);
			t->size -= 1;
			
			return balance(t);
		}

		MemoryManager<Node> move_down(MemoryManager<Node>& t, const MemoryManager<Node>& rhs) {
			if (t == nullptr)
				return rhs;

			t->child[1] = move_down(t->child[1], rhs);
			return balance(t);
		}

		MemoryManager<Node> rotate(MemoryManager<Node>& t, int l, int r) {
			MemoryManager<Node> s = std::move(t->child[r]);
			t->child[r] = std::move(s->child[l]);
			s->child[l] = balance(t);
			if (t)
				t->size = node_size_or(t->child[0]) + node_size_or(t->child[1]) + 1;

			if (s)
				s->size = node_size_or(s->child[0]) + node_size_or(s->child[1]) + 1;

			return balance(s);
		}

		MemoryManager<Node> balance(MemoryManager<Node>& t) {
			for (int i = 0; i < 2; ++i) {
				if (node_height_or(t->child[1 - i]) - node_height_or(t->child[i]) < -1) {
					if (node_height_or(t->child[i]->child[!i]) - node_height_or(t->child[i]->child[i]) > 0)
						t->child[i] = rotate(t->child[i], i, !i);

					return rotate(t, !i, i);
				}
			}

			if (t) {
				t->height = std::max(node_height_or(t->child[0]), node_height_or(t->child[1])) + 1;
				t->size = node_size_or(t->child[0]) + node_size_or(t->child[1]) + 1;
			}

			return t;
		}

		MemoryManager<Node> rank_impl(const MemoryManager<Node>& t, int k) const {
			if (!t)
				return nullptr;

			const int m = node_size_or(t->child[0]);
			
			if (k < m)
				return rank_impl(t->child[0], k);
			else if (k == m)
				return t;
			else
				return rank_impl(t->child[1], k - m - 1);
		}

	public:
		Tree(const Compare& c = Compare{}) : comp_type(c), root(nullptr) {}
		Tree(const Tree&) = delete;
		Tree(Tree&&) = default;
		Tree& operator = (const Tree&) = delete;
		Tree& operator = (Tree&&) = default;

		template<typename T>
		MemoryManager<Node> find(const T& key) const {
			return find_impl(root, key);
		}
		template<typename... Args>
		void insert(Args&&... args) {
			root = insert_impl(root, Util:: template makeResource<MemoryManager<Node>>(std::forward<Args>(args)...));
		}
		template<typename T>
		void erase(const T& key) {
			root = erase_impl(root, key);
		}
		MemoryManager<Node> rank(int k) const {
			return rank_impl(root, k);
		}

	};

	template<typename T, typename Compare = detail::less>
	using Set = Tree<typename Node::template One<T>, Compare>;

	template<typename S, typename T, typename Compare = detail::less>
	class Map {
		Tree<typename Node::template Pair<S, T>, Compare> tree;

	public:

		Map(const Compare& c = Compare()) : tree(c) {}
		Map(const Map&) = delete;
		Map(Map&&) = default;
		Map& operator=(const Map&) = delete;
		Map& operator=(Map&&) = default;
		void insert(const S& s, const T& t) {
			if (tree.find(s) == nullptr)
				tree.insert(s, t);
		}
		void erase(const S& key) {
			tree.erase(key);
		}
		MemoryManager<typename Node::template Pair<S, T>> find(const S& key) const {
			return tree.find(key);
		}
		MemoryManager<typename Node::template Pair<S, T>> rank(int r) const {
			return tree.rank(r);
		}

		const T& operator [] (const S& key) const {
			if (tree.find(key) == nullptr)
				tree.insert(key, T{});

			return tree.find(key)->val;
		}
		T& operator [] (const S& key) {
			if (tree.find(key) == nullptr)
				tree.insert(key, T{});

			return tree.find(key)->val;
		}
	};
};

//End : AVLTree.hpp


template<typename T>
inline T input(std::istream& is = std::cin){
  T t;
  is >> t;
  return t;
}

int main(){
  const auto n = input<int>();
  const auto c = input<int>();
  const auto comparer =
    [](const auto& lhs, const auto& rhs){
      return lhs.first > rhs.first || (lhs.first == rhs.first && lhs.second < rhs.second);
    };
  Avl<RawPointer>::Set<std::pair<long long, int>, decltype(comparer)> tree(comparer);
  std::vector<long long> scores(n);

  for(int i = 0; i < n; ++i) {
    tree.insert(std::make_pair(0, i));
  }

  for(int i = 0; i < c; ++i) {
    const auto flag = input<int>();
    if(flag == 0) {
      const auto t = input<int>() - 1;
      const auto p = input<long long>();
      {
        auto node = tree.find(std::make_pair(scores[t], t));
        tree.erase(node->key);
      }
      scores[t] += p;
      tree.insert(std::make_pair(scores[t], t));
    }
    else {
      const auto m = input<int>() - 1;
      auto node = tree.rank(m);
      std::cout << node->key.second + 1 << " " << node->key.first << std::endl;
    }
  }
}

Measured memory_bytes: 12828