Problem: White Tiger University holds a programming contest every year. The contest starts with a score of 0 for all teams, and points are added according to the answer status. In this contest, rankings will be made in descending order of score. When the total number of teams is N, each team is assigned a number from 1 to N. If the scores are the same, the one with the smaller number will be ranked higher.

White Tiger University is developing a ranking system for watching games to liven up the contest. As a member of the development team, you are responsible for creating the programs that are part of this system.

Create a program that updates the score and reports the number and score of the team in the specified ranking according to the instructions given.



Input

The input is given in the following format.


N C
command1
command2
::
commandC


The number of teams N (2 ≤ N ≤ 100000) and the number of instructions C (1 ≤ C ≤ 100000) are given on the first line. Instructions are given line by line to the following C line. Each instruction is given in the following format.


0 t p


Or


1 m


When the first number is 0, it indicates an update command, and when it is 1, it represents a report command. The update instruction adds the integer score p (1 ≤ p ≤ 109) to the team with the specified number t (1 ≤ t ≤ N). The reporting order reports the number and score of the team with the specified rank m (1 ≤ m ≤ N). However, the reporting order shall appear at least once.

Output

For each report command, the number and score of the team with the specified rank are output on one line separated by blanks.

Examples

Input

3 11
0 2 5
0 1 5
0 3 4
1 1
1 2
1 3
0 3 2
1 1
0 2 1
1 2
1 3


Output

1 5
2 5
3 4
3 6
3 6
1 5


Input

5 2
1 1
1 2


Output

1 0
2 0

Solution (in CPP):

Solution:
#include <algorithm>

template <typename T = int>
class AvlTree {
public:
    struct node {
        T key;
        int size, height;
        node* child[2];
        node(const T &key) : key(key), size(1), height(1) {
            child[0] = child[1] = 0;
        }
        node(node&&) = default;
        node(const node&) = default;
        node& operator = (const node&) = default;
        node& operator = (node&&) = default;
    };
private:
    // Variable
    node* root;
    
    // Functions
    int node_size_or(node* n) const {
        return n ? n->size : 0;
    }
    int node_height_or(node* n) const {
        return n ? n->height : 0;
    }

    node* find_impl(node *t, const T &key) {
        if(t == nullptr)
            return nullptr;
        if(key == t->key)
            return t;
        else if(key < t->key)
            return find_impl(t->child[0], key);
        else
            return find_impl(t->child[1], key);
    }
    node* insert_impl(node *t, node *x) {
        if (t == nullptr)
            return x;

        if(x->key <= t->key)
            t->child[0] = insert_impl(t->child[0], x);
        else
            t->child[1] = insert_impl(t->child[1], x);
        t->size += 1;

        return balance(t);
    }

    node* erase_impl(node *t, const T &x) {
        if (t == nullptr) return nullptr;
        if (x == t->key) {
            return move_down(t->child[0], t->child[1]);
        } else {
            if(x < t->key)
                t->child[0] = erase_impl(t->child[0], x);
            else
                t->child[1] = erase_impl(t->child[1], x);
            
            t->size -= 1;
            
            return balance(t);
        }
    }

    node* move_down(node *t, node *rhs) {
        if (t == nullptr) return rhs;
        t->child[1] = move_down(t->child[1], rhs);
        return balance(t);
    }

    node* rotate(node *t, int l, int r) {
        node *s = t->child[r];
        t->child[r] = 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);
    }

    node* balance(node *t) {
        for (int i = 0; i < 2; ++i) {
            if (node_height_or(t->child[!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;
        if(t)
            t->size = node_size_or(t->child[0]) + node_size_or(t->child[1]) + 1;

        return t;
    }

    node* rank_impl(node *t, int k) const {
        if (!t) return nullptr;
        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:
    AvlTree() {
        root = nullptr;
    }
    AvlTree(const AvlTree&) = delete;
    AvlTree(AvlTree&&) = default;
    AvlTree& operator = (const AvlTree&) = delete;
    AvlTree& operator = (AvlTree&&) = default;

    ~AvlTree() {
        delete root;
    }

    node* find(const T &key) {
        return find_impl(root, key);
    }
    void insert(const T &key) {
        root = insert_impl(root, new node(key));
    }
    void erase(const T &key) {
        root = erase_impl(root, key);
    }
    node* rank(int k) const {
        return rank_impl(root, k);
    }

};

#include <iostream>
#include <utility>
#include <vector>
int n, q;

int main() {
    std::cin >> n >> q;

    AvlTree<std::pair<long long, int>> tree;
    std::vector<long long> scores(n);

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

    long long a, b, c;
    for(int i = 0; i < q; ++i) {
        std::cin >> a >> b;
        --b;

        if(a == 0) {
            std::cin >> c;

            auto p = tree.find(std::make_pair(scores[b], b));
            tree.erase(p->key);
            
            scores[b] -= c;

            tree.insert(std::make_pair(scores[b], b));
        }else {
            auto p = tree.rank(b);
            
            std::cout << p->key.second + 1 << " " << -p->key.first << std::endl;
        }
    }
}

/*
In:
3 11 
0 2 5
0 1 5
0 3 4
1 1
1 2
1 3
0 3 2
1 1
0 2 1
1 2 
1 3

Out:
1 5
2 5
3 4
3 6
3 6
1 5
*/

/*
In:
5 2
1 1
1 2

Out:
1 0
2 0
*/