#include <stdio.h>

int main()
{
        int shop[5];
        int m,e;
        int i=0,top_s,max=0;

        while (scanf("%d %d", &m, &e) && !(m == 0 && e == 0)) {

                shop[i] = m+e;
                if (shop[i] > max) {
                        max = shop[i];
                        top_s = i;
                }

                i++;
                if (i > 4) {
                        printf("%c %d", top_s+'A', max);
                        i = max = 0;
                }
        }
        return 0;
}