{
TASK:roulette
LANG:PASCAL
}
program roulette;

const
	MAXQ						= 15625;

type
	Integer						= LongInt;
	TTableEl					= record
		w					: Boolean;
		m					: Integer;
	end;
	TQueueEl					= record
		i					: Array [1 .. 6] of Integer;
	end;

var
	t						: Array [0 .. 4, 0 .. 4, 0 .. 4, 0 .. 4, 0 .. 4, 0 .. 4] of TTableEl;
	cl						: Array [0 .. 4, 0 .. 4, 0 .. 4, 0 .. 4, 0 .. 4, 0 .. 4] of Integer;
	used						: Array [0 .. 4, 0 .. 4, 0 .. 4, 0 .. 4, 0 .. 4, 0 .. 4] of Boolean;
	wpos						: Array [1 .. 6] of Boolean;
	Q						: Array [1 .. MAXQ] of TQueueEl;
	ind						: Array [1 .. 6] of Integer;
	s						: String;
	a, b, c, d, e, f, qb, qe, i, is, cnt		: Integer;
	code						: Word;
	who						: Char;

procedure readInput;
begin
	readln(s);
end;

procedure push(a, b, c, d, e, f: Integer);
begin
	qb := qb - 1;
	q[qb].i[1] := a; q[qb].i[2] := b; q[qb].i[3] := c;
	q[qb].i[4] := d; q[qb].i[5] := e; q[qb].i[6] := f;
end;

procedure pull(var a, b, c, d, e, f: Integer);
begin
	a := q[qe].i[1]; b := q[qe].i[2]; c := q[qe].i[3];
	d := q[qe].i[4]; e := q[qe].i[5]; f := q[qe].i[6];
	qe := qe - 1;
end;

function sum(a, b, c, d, e, f: Integer): Integer;
begin
	sum := a + b * 2 + c * 3 + d * 4 + e * 5 + f * 6;
end;

function check(a, b, c, d, e, f: Integer): Boolean;
begin
	check := False;
	wpos[1] := False; wpos[2] := False; wpos[3] := False; wpos[4] := False; wpos[5] := False; wpos[6] := False; 
	if (a+1 <= 4) and (sum(a+1, b, c, d, e, f) <= 49) and (not t[a+1, b, c, d, e, f].w) then begin
		check := True;
		wpos[1] := True;
	end;
	if (b+1 <= 4) and (sum(a, b+1, c, d, e, f) <= 49) and (not t[a, b+1, c, d, e, f].w) then begin
		check := True;
		wpos[2] := True;
	end;
	if (c+1 <= 4) and (sum(a, b, c+1, d, e, f) <= 49) and (not t[a, b, c+1, d, e, f].w) then begin
		check := True;
		wpos[3] := True;
	end;
	if (d+1 <= 4) and (sum(a, b, c, d+1, e, f) <= 49) and (not t[a, b, c, d+1, e, f].w) then begin
		check := True;
		wpos[4] := True;
	end;
	if (e+1 <= 4) and (sum(a, b, c, d, e+1, f) <= 49) and (not t[a, b, c, d, e+1, f].w) then begin
		check := True;
		wpos[5] := True;
	end;
	if (f+1 <= 4) and (sum(a, b, c, d, e, f+1) <= 49) and (not t[a, b, c, d, e, f+1].w) then begin
		check := True;
		wpos[6] := True;
	end;





end;

procedure Solve;
begin
	for a := 0 to 4 do
	for b := 0 to 4 do
	for c := 0 to 4 do
	for d := 0 to 4 do
	for e := 0 to 4 do
	for f := 0 to 4 do begin
		used[a, b, c, d, e, f] := False;
		t[a, b, c, d, e, f].w := True;
		t[a, b, c, d, e, f].m := 0;
		cl[a, b, c, d, e, f] := 0;
	end;
	qb := MAXQ + 1;
	qe := MAXQ;
	used[4, 4, 4, 4, 4, 4] := True;
	push(4, 4, 4, 4, 4, 4);
	while (qb <= qe) do begin
		pull(a, b, c, d, e, f);
		cnt := 0;
		if (a < 4) then cnt := cnt + 1;
		if (b < 4) then cnt := cnt + 1;
		if (c < 4) then cnt := cnt + 1;
		if (d < 4) then cnt := cnt + 1;
		if (e < 4) then cnt := cnt + 1;
		if (f < 4) then cnt := cnt + 1;

		if (cl[a, b, c, d, e, f] < cnt) then
			t[a, b, c, d, e, f].w := True
		else
			t[a, b, c, d, e, f].w := False;

		if (t[a, b, c, d, e, f].w) then begin
			if (a+b*2+c*3+d*4+e*5+f*6 >= 49) then
				t[a, b, c, d, e, f].w := False
			else begin
				if (check(a, b, c, d, e, f)) then begin
					if (wpos[1]) then
						t[a, b, c, d, e, f].m := 1;
					if (wpos[2]) then
					t[a, b, c, d, e, f].m := 2;
					if (wpos[3]) then
						t[a, b, c, d, e, f].m := 3;
					if (wpos[4]) then
						t[a, b, c, d, e, f].m := 4;
					if (wpos[5]) then
						t[a, b, c, d, e, f].m := 5;
					if (wpos[6]) then
						t[a, b, c, d, e, f].m := 6; 

					if (a-1 >= 0) then inc(cl[a-1, b, c, d, e, f]);
					if (b-1 >= 0) then inc(cl[a, b-1, c, d, e, f]);
					if (c-1 >= 0) then inc(cl[a, b, c-1, d, e, f]);
					if (d-1 >= 0) then inc(cl[a, b, c, d-1, e, f]);
					if (e-1 >= 0) then inc(cl[a, b, c, d, e-1, f]);
					if (f-1 >= 0) then inc(cl[a, b, c, d, e, f-1]);
				end else
					t[a, b, c, d, e, f].w := False;
			end;
			
		end;


		if (a-1 >= 0) and (not used[a-1, b, c, d, e, f]) then begin
			used[a-1, b, c, d, e, f] := True;
			push(a-1, b, c, d, e, f);
		end;
		if (b-1 >= 0) and (not used[a, b-1, c, d, e, f]) then begin
			used[a, b-1, c, d, e, f] := True;
			push(a, b-1, c, d, e, f);
		end;
		if (c-1 >= 0) and (not used[a, b, c-1, d, e, f]) then begin
			used[a, b, c-1, d, e, f] := True;
			push(a, b, c-1, d, e, f);
		end;
		if (d-1 >= 0) and (not used[a, b, c, d-1, e, f]) then begin
			used[a, b, c, d-1, e, f] := True;
			push(a, b, c, d-1, e, f);
		end;
		if (e-1 >= 0) and (not used[a, b, c, d, e-1, f]) then begin
			used[a, b, c, d, e-1, f] := True;
			push(a, b, c, d, e-1, f);
		end;
		if (f-1 >= 0) and (not used[a, b, c, d, e, f-1]) then begin
			used[a, b, c, d, e, f-1] := True;
			push(a, b, c, d, e, f-1);
		end;

	end;

	for i := 1 to 6 do ind[i] := 0;
	for i := 1 to Length(s) do begin
		val(s[i], is, code);
		ind[is] := ind[is] + 1;
	end;
	if (Length(s) mod 2 = 0) then 
		who := 'G'
	else
		who := 'T';
	writeln(who, ' ', t[ind[1],ind[2],ind[3],ind[4],ind[5],ind[6]].m);
end;

begin
	readInput;
	Solve;
end.