1. 

/**
* FWP, Ausgew√¤hlte Probleme aus dem ACM Programming Contest, SS10
* Problem: 102 Ecological Bin Packing
* Link: http://uva.onlinejudge.org/external/1/102.html
*
* @author Barny Porcio
* @version 1.0, 04/10/2010
*
* Method : -
* Status : Accepted
* Runtime: 1.312
*/
import java.util.Scanner;


public class ecologicalbinpacking102 {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
String[] solu = new String[]{"BCG","BGC","CBG","CGB","GBC","GCB"};
//
while (sc.hasNext()){
int[][] box = new int[3][3];
for (int i = 0;i <9;++i)
box[i/3][i%3] = sc.nextInt();
//0 = brown 1= green 2 = clean
int min ;
//Array wird bef√¼llt, bevorzugt mit 0 2 1 Prioritaet
int[] lala = new int[6];
lala[1] = box[0][1]+box[0][2]+box[1][0]+box[1][2]+box[2][0]+box[2][1]; // 0 1 2 2
min = lala[1];
lala[0] = box[0][1]+box[0][2]+box[1][0]+box[1][1]+box[2][0]+box[2][2]; // 0 2 1 1
if (lala[0] < min )
min = lala[0];
lala[4] = box[0][0]+box[0][2]+box[1][1]+box[1][2]+box[2][0]+box[2][1]; // 1 0 2 5
if (lala[4] < min )
min = lala[4];
lala[5] = box[0][0]+box[0][2]+box[1][0]+box[1][1]+box[2][1]+box[2][2]; // 1 2 0 6
if (lala[5] < min )
min = lala[5];
lala[2] = box[0][0]+box[0][1]+box[1][1]+box[1][2]+box[2][0]+box[2][2]; // 2 0 1 3
if (lala[2] < min )
min = lala[2];
lala[3] = box[0][0]+box[0][1]+box[1][0]+box[1][2]+box[2][1]+box[2][2]; // 2 1 0 4
if (lala[3] < min )
min = lala[3];
int i = 0;
while (min != lala[i])
i++;
System.out.println(solu[i]+" "+min);
}
}
}