import java.util.*;

class Player{
	int id;
	int matchesPlayed;
	int totalRuns;
	String name;
	String team;
	
	Player(int id, int matchesPlayed, int totalRuns, String name, String team){
		this.id = id;
		this.matchesPlayed = matchesPlayed;
		this.totalRuns = totalRuns;
		this.name = name;
		this.team = team;
	}
}
class Ideone{
	
	public static int fATROP(Player[] players){
		int sum = 0;
		
		for(Player p : players){
			sum += p.totalRuns;
		}
		
		if(sum == 0){
			return 0;
		}
		return  (sum / players.length);
		
	}
	public static ArrayList<Player> fPWMMP(Player[] players){
		 
		ArrayList<Player> ls = new ArrayList<>();
		
		for(Player p : players){
			ls.add(p);
		}
		
		if(ls.size() == 0){
			return null;
		}
		
		Collections.sort(ls, (a,b) -> Integer.compare(a.matchesPlayed, b.matchesPlayed));
		
		return ls ;
	}
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		Integer  n = sc.nextInt(); sc.nextLine();
		
		Player[] players = new Player[n];
	
		for(int i = 0; i < n; i++){
		Integer  a = sc.nextInt(); sc.nextLine();
		Integer b = sc.nextInt(); sc.nextLine();
		Integer c = sc.nextInt(); sc.nextLine();
		String d = sc.nextLine();
		String e = sc.nextLine();
		players[i] = new Player(a, b, c, d, e);
		}	
		
	int avg = fATROP(players);
	
	if(avg == 0){
		System.out.println();
	}else{
		System.out.println("Avg of total Players is: " + avg);
	}
 ArrayList<Player> list2  =	fPWMMP(players);
	
	if(list2 == null){
		System.out.print("No Player found with mentioned attribute");
	}else{
		Player p = list2.get(0);
		
		System.out.println("id:" + p.id);
		System.out.println("matchPlayed:" + p.matchesPlayed);
		System.out.println("totalRuns:" + p.totalRuns);
		System.out.println("name:" + p.name);
		
	}
	}
}