#include<stdio.h>
int main(void)
{
    char str[7] = { "\nABCDE" };
    int i, s1[6], s2[6], temp[6], max=0,max_s=0;
        for (i = 1; i <= 5; i++) {
            scanf("%d %d", &s1[i], &s2[i]);
            temp[i] = s1[i] + s2[i];
            if (max < temp[i]) {
                max = temp[i];
                max_s = i;
            }
            if (s1[1] <= 0 && s2[1] <= 0) {
                break;                
            }
        }
        while (s1[1] > 0 && s2[1] > 0) {        
            for (i = 1; i <= 5; i++) {
                if (max == temp[i]) {
                    printf("%c %d\n", str[i], temp[i]);
                }
            }
            for (i = 1; i <= 5; i++) {
                scanf("%d %d", &s1[i], &s2[i]);
                temp[i] = s1[i] + s2[i];
                if (max < temp[i]) {
                    max = temp[i];
                    max_s = i;
                }
                if (s1[1] <= 0 && s2[1] <= 0) {
                    break;
                }
            }
        }
    return 0;
}