#define scanf_s scanf
#include <stdio.h>
#include<iostream>
#include <list>
#include <vector>
#include <iostream>
using namespace std;
#define MAX 101
#define MIN 101
int main()
{
	int A[5], am, pn, maxi = 0;
	char name[] = { "ABCDE" };
	while (1) {
		maxi = 0;
		for (int i = 0; i < 5; ++i) {
			scanf_s("%d %d", &am, &pn);
			if (pn == 0 && am == 0) break;
			A[i] = am + pn;
			if (A[i] > A[maxi]) {
				maxi = i;
			}
		}
		printf("%c %d\n", name[maxi], A[maxi]);
	}

}