uses sysutils;

var
	n1, n2, m : integer;
	i, u, v : integer;
	e : array[1..2000,1..2000] of boolean;
		
begin
	n1 := strtoint(paramstr(1));
	n2 := strtoint(paramstr(2));
	m := strtoint(paramstr(3));
	randseed := strtoint(paramstr(4));
	
	writeln(n1 + n2, ' ', m);
	
	for i := 1 to n1 do
		if random(2) = 0 then
			write('G')
		else
			write('B');		
	for i := 1 to n2 do
		if random(2) = 0 then
			write('B')
		else
			write('R');
	writeln;

	fillchar(e, sizeof(e), false);
	for i := 1 to m do begin
		repeat
			u := random(n1) + 1;
			v := random(n2) + 1;
		until not e[u,v];
		e[u,v] := true;
		writeln(u, ' ', n1 + v);
	end;		
end.
