import java.util.Scanner;

public class Section034_Type2 {
	public static void main(String[] args) {
		Scanner scanf = new Scanner(System.in);
		int i, j, r;
		int kuk[] = new int[10];
		int mat[] = new int[10];
		int hap[] = new int[10];
		i = -1;
		do
		{
			i++;
			kuk[i] = scanf.nextInt();
			mat[i] = scanf.nextInt();
			hap[i] = kuk[i] + mat[i];
		} while (i < 9);
		for (i = 0; i <= 9; i++)
		{
			if (hap[i] != 0)
			{
				r = 1;
				for (j = 0; j <= 9; j++)
				{
					if (hap[i] < hap[j])
						r++;
				}
				System.out.printf("%d %d %d %d %d\n", i+1, kuk[i], mat[i], hap[i], r);
			}
		}
		scanf.close();
	}
}
