//Jackson Simoneau
//COP 3503H - Fall 2026
//P1: Rightsizing

import java.util.*;
public class rightsize {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt(), q = input.nextInt();

        //map stores all distinct salaries and the list of employees with that salary
        TreeMap<Long, TreeSet<String>> map = new TreeMap<>();
        //salMap maps each employee's name to their current salary
        HashMap<String, Long> salMap = new HashMap<>();

        //read input and insert into maps
        for(int i = 0; i < n; i++) {
            String name = input.next();
            long sal = input.nextInt();
            map.putIfAbsent(sal, new TreeSet<String>());
            map.get(sal).add(name);
            salMap.put(name, sal);
        }

        //process queries
        while(q-- > 0) {
            int type = input.nextInt();
            if(type == 1) {
                String name = input.next();
                long inc = input.nextInt();
                long newSal = salMap.get(name) + inc;

                //remove employee from previous salary list
                map.get(newSal-inc).remove(name);
                //delete salary entry if no other employees have that salary anymore
                if(map.get(newSal-inc).isEmpty()) map.remove(newSal-inc);
                //add new set if necessary
                map.putIfAbsent(newSal, new TreeSet<String>());

                //insert employee into new salary list and update their current salary
                map.get(newSal).add(name);
                salMap.replace(name, newSal);
            } else {
                //find the highest salary of any employee
                long sal = map.lastKey();
                //remove the alphabetically first employee with this salary
                String name = map.get(sal).pollFirst();
                
                //display the removed employee
                System.out.println(name + " " + sal);
                
                //delete salary entry if necessary
                if(map.get(sal).isEmpty()) map.remove(sal);
            }
        }
    }
}