import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
* ACM Problem #102 (Bin Packing)
*
* @author Felix Dietrich
* @version 1.0, 26/07/09
*
* Status : Accepted
*/

class Main
{

static BufferedReader reader;
static BufferedReader outputReader;
static boolean useTestData = false;
static String testData = "test.txt";

private static String readline(int maxLg) throws IOException
{
if(useTestData)
return reader.readLine();

byte lin[] = new byte [maxLg];
int lg = 0, car = -1;

try
{
while (lg < maxLg)
{
car = System.in.read();
if ((car < 0) || (car == '\n')) break;
lin [lg++] += car;
}
}
catch (IOException e)
{
return (null);
}

if ((car < 0) && (lg == 0)) return (null); // eof
return (new String (lin, 0, lg));

}

public static void main(String args[]) throws IOException
{
String input;
Main main = new Main();

if (useTestData)
{
reader = new BufferedReader(new FileReader(testData));
outputReader = new BufferedReader(new FileReader("output.txt"));
}
else
reader = new BufferedReader(new InputStreamReader(System.in));


while ((input = readline(255)) != null)
{
if (input.length() < 17)
continue;
main.work(input); // the true entry point
}
}

// / Code starts here
static final int B = 0;
static final int C = 1;
static final int G = 2;

private void work(String input) throws IOException
{
StringTokenizer st = new StringTokenizer(input);
int[] colors = new int[9];
for (int i = 0; i < 9; i++)
colors[i] = Integer.parseInt(st.nextToken());

int[][] moves = new int[][] { { B, C, G }, { B, G, C }, { C, B, G }, { C, G, B },
{ G, B, C }, { G, C, B } };

int maxmoves = -1;
int bestmove = 0;

for (int i = 0; i < 6; i++)
{
if (maxmoves == moves(moves[i], colors) && comparemoves(moves[bestmove],moves[i]) < 0)
{
maxmoves = moves(moves[i], colors);
bestmove = i;
}
if (maxmoves > moves(moves[i], colors) || maxmoves == -1)
{
maxmoves = moves(moves[i], colors);
bestmove = i;
}
//System.out.println(moves(moves[i], colors));
}

String result = "";
for (int i = 0; i < 3; i++)
{
if (moves[bestmove][i] == B)
result += "B";
if (moves[bestmove][i] == C)
result += "C";
if (moves[bestmove][i] == G)
result += "G";
}
System.out.println(result + " " + maxmoves);
String r;
if(useTestData)
{
r = outputReader.readLine().trim();
if(!r.equals(result + " " + maxmoves))
System.out.print("!!!!" + r);
}
}

private int comparemoves(int[] is, int[] is2)
{
if(is[0] < is2[0])
return 1;
if(is[0] > is2[0])
return -1;
if(is[1] < is2[1])
return 1;
if(is[1] > is2[1])
return -1;
if(is[2] < is2[2])
return 1;
if(is[2] > is2[2])
return -1;
return 0;
}

// B G C
int moves(int[] move, int[] colors)
{
int moves = 0;

if (move[0] == B)
moves += colors[3] + colors[6];
if (move[0] == G)
moves += colors[4] + colors[7];
if (move[0] == C)
moves += colors[5] + colors[8];

if (move[1] == B)
moves += colors[0] + colors[6];
if (move[1] == G)
moves += colors[1] + colors[7];
if (move[1] == C)
moves += colors[2] + colors[8];

if (move[2] == B)
moves += colors[3] + colors[0];
if (move[2] == G)
moves += colors[4] + colors[1];
if (move[2] == C)
moves += colors[5] + colors[2];

return moves;
}
}