import java.io.FileReader;
import java.io.IOException;
import java.util.Scanner;

public class Test04 {
	public static void main(String[] args) throws IOException {
		Scanner inf = new Scanner(new FileReader("data01.txt"));
		String name;
		int kor, mat, eng, cnt, i, j;
		String irum[] = new String[50];
		int jumsu[] = new int[50];
		int rank[] = new int[50];
		cnt = -1;
		while(true)
		{
			cnt++;
			if(!inf.hasNext())
				break;
			name = inf.next();
			kor = inf.nextInt();
			mat = inf.nextInt();
			eng = inf.nextInt();
			jumsu[cnt] = kor + mat + eng;
			irum[cnt] = name;
		}
		cnt--;
		i = 0;
		while (i <= cnt)
		{
			rank[i] = 1;
			i++;
		}
		i = 0;
		while(i <= cnt)
		{
			j = 0;
			while (j <= cnt)
			{
				if (jumsu[i] < jumsu[j])
					rank[i]++;
				j++;
			}
			i++;
		}
		for (int x = 0; x <= cnt; x++)
			System.out.printf("%s %d %d\n", irum[x], jumsu[x], rank[x]);
		inf.close();
	}
}
