// Arup Guha
// 4/2/2026
// Short Application to Illustrate TreeMap use.

import java.util.*;

public class Basketball {

	public static void main(String[] args) {
	
		// REad in the number of operations.
		Scanner stdin = new Scanner(System.in);
		int numOps = stdin.nextInt();
		
		// You can go back and substitute this with a HashMap and everything works
		// except that the print isn't in alphabetical order.
		TreeMap<String,Stats> team = new TreeMap<String,Stats>();
		
		// Process operations.
		for (int loop=0; loop<numOps; loop++) {
		
			// Get op
			int op = stdin.nextInt();
			
			// Points scored.
			if (op == 1) {
				String name = stdin.next();
				int pts = stdin.nextInt();
				addPoints(team, name, pts);
			}
			
			// Rebound.
			else if (op == 2) {
				String name = stdin.next();
				addRebound(team, name);
			}
			
			// Assist.
			else if (op == 3) {
				String name = stdin.next();
				addAssist(team, name);
			}
			
			// Print the statistics.
			else {
				printStats(team);
			}
		}
	}
	
	// Prints statistics stored in team in order of the key (Player name).
	public static void printStats(TreeMap<String,Stats> team) {
		for (String player: team.keySet())
			System.out.println(player+"\t"+team.get(player));
		System.out.println("-------------------------------------\n");
	}
	
	// Adds pts points to the player name on team.
	public static boolean addPoints(TreeMap<String,Stats> team, String name, int pts) {
		
		// Add to map if necessary.
		if (!team.containsKey(name))
			team.put(name, new Stats());
		
		// Get the stats object.
		Stats obj = team.get(name);
		
		// Figure out which method to call.
		if (pts == 1) 		obj.addFreeThrow();
		else if (pts == 2)	obj.add2Pointer();
		else if (pts == 3)	obj.add3Pointer();
		else				return false;
		
		// If we get here the points were added.
		return true;
	}
	
	// Adds a rebound to the player name on team
	public static void addRebound(HashMap<String,Stats> team, String name) {
		
		// Add to map if necessary.
		if (!team.containsKey(name))
			team.put(name, new Stats());
		
		// Now we can add the rebound.
		team.get(name).addRebound();
	}
	
	// Adds an assist to the player name on team.
	public static void addAssist(HashMap<String,Stats> team, String name) {
		
		// Add to map if necessary.
		if (!team.containsKey(name))
			team.put(name, new Stats());
		
		// Now we can add the assist.
		team.get(name).addAssist();
	}
}


class Stats {

	// Our statistics.
	private int points;
	private int rebounds;
	private int assists;
	
	// Everyone starts with nothing!
	public Stats() {
		points = 0;
		rebounds = 0;
		assists = 0;
	}
	
	// Can get 1 assist at a time.
	public void addAssist() {
		assists++;
	}
	
	// Same for rebound.
	public void addRebound() {
		rebounds++;
	}
	
	// One type of shot.
	public void addFreeThrow() {
		points++;
	}
	
	// A second type of shot.
	public void add2Pointer() {
		points += 2;
	}
	
	// Last type of shot.
	public void add3Pointer() {
		points += 3;
	}
	
	// For printing.
	public String toString() {
		return "Points: "+points+" Rebounds: "+rebounds+" Assists: "+assists;
	}
}