uses sysutils;

const
	max_n = 2000;
	colnames : array[0..2] of char = ('R', 'G', 'B');
	
var
	col : array[1..max_n] of integer;
	
	e : array[1..max_n,1..max_n] of boolean;

	n, m : integer;
	i : integer;
	
	u, v : integer;
	
begin
	n := strtoint(paramstr(1));
	m := strtoint(paramstr(2));
	randseed := strtoint(paramstr(3));
	
	for i := 1 to n do
		col[i] := random(3);
		
	writeln(n, ' ', m);
	for i := 1 to n do begin
		write(colnames[col[i]]);
	end;
	writeln;

	fillchar(e, sizeof(e), 0);	
	for i := 1 to m do begin
		repeat
			u := random(n) + 1;
			v := random(n) + 1;
		until (col[u] <> col[v]) and not e[u,v];
		
		writeln(u, ' ', v);
		e[u,v] := true;
		e[v,u] := true;
	end;
end.
