indexes = '123 132 213 231 312 321'.split()
chars = ['BCG','BGC','CBG','CGB','GBC','GCB' ]
results = []

def RecycleBin():
    data = raw_input().split()
    for str in indexes : # seq in indexes
        sum=0
        num=[int(str[0])-1, int(str[1])+2, int(str[2])+5]
        for i in range(0,9):
            if not (i== num[0] or \
               i== num[1] or \
               i== num[2] ):
                sum+=int(data[i])
        results.append(sum)
    min=1000
    idx=0
    for i in range(len(results)):
        if min>results[i]:
            min=results[i]
            idx=i
    print chars[idx],results[idx]

RecycleBin()