#include int main() { // b, g, c int first [3]; int second[3]; int third [3]; while ( scanf("%d %d %d %d %d %d %d %d %d", &first[0], &first[1], &first[2], &second[0], &second[1], &second[2], &third[0], &third[1], &third[2]) == 9 ) { int gbc = first[0]+first[2]+second[1]+second[2]+third[0]+third[1]; int gcb = first[0]+first[2]+second[0]+second[1]+third[1]+third[2]; int bgc = first[1]+first[2]+second[0]+second[2]+third[0]+third[1]; int bcg = first[1]+first[2]+second[0]+second[1]+third[0]+third[2]; int cgb = first[0]+first[1]+second[0]+second[2]+third[1]+third[2]; int cbg = first[0]+first[1]+second[1]+second[2]+third[0]+third[2]; int min = gbc; if ( min > gcb ) min = gcb; if ( min > bgc ) min = bgc; if ( min > bcg ) min = bcg; if ( min > cgb ) min = cgb; if ( min > cbg ) min = cbg; if ( min == bcg ) printf("BCG %d\n", min); else if ( min == bgc ) printf("BGC %d\n", min); else if ( min == cbg ) printf("CBG %d\n", min); else if ( min == cgb ) printf("CGB %d\n", min); else if ( min == gbc ) printf("GBC %d\n", min); else if ( min == gcb ) printf("GCB %d\n", min); } return 0; }