program color;

const
	maxn = 1000;
	maxm = 20000;

var
	n, m: longint;
	c, nc, fc: array [1..maxn] of integer;
	a, b: longint;
	en: longint;
	head: array [1..maxn] of longint;
	d: array [1..2 * maxm] of longint;
	next: array [1..2 * maxm] of longint;
	s: string;

procedure addedge(a, b: longint);
begin
	inc(en);
	next[en] := head[a];
	head[a] := en;
	d[en] := b;
end;

function bt(i, color: longint): boolean;
var
	j, jc: longint;
begin
	nc[i] := color;
	j := head[i];
	while j <> 0 do begin
		if (c[d[j]] <> color) then begin
			if (nc[d[j]] <> 0) then begin
				if nc[d[j]] = color then begin
    				bt := false;
    				exit;
    			end;
			end else begin
    			for jc := 1 to 3 do begin
    				if (jc <> c[d[j]]) and (jc <> color) then begin
    					if not bt(d[j], jc) then begin
    						bt := false;
    						exit;
    					end;
    				end;
    			end;
    		end;
		end;
		j := next[j];
	end;
	bt := true;
end;

procedure dump;
var
	i: longint;
begin
	for i := 1 to n do begin
		if nc[i] <> 0 then begin
			fc[i] := nc[i];
		end;
	end;
end;

var
	i: longint;
	u: array [1..maxn, 1..maxn] of boolean;
	ok: boolean;

begin
	reset(input, 'color.in');
	rewrite(output, 'color.out');

	readln(n, m);
	assert((1 <= n) and (n <= maxn));
	assert((0 <= m) and (m <= maxm));
	readln(s);
	assert(length(s) <= n);
	for i := 1 to n do begin
		assert(s[i] in ['R', 'G', 'B']);
		c[i] := pos(s[i], 'RGB');
	end;

	for i := 1 to m do begin
		readln(a, b);
		assert(a <> b);
		assert((1 <= a) and (a <= n));
		assert((1 <= b) and (b <= n));
		assert(not u[a][b]);
		u[a][b] := true;
		u[b][a] := true;
		addedge(a, b);
		addedge(b, a);
	end;

	ok := true;
    for i := 1 to n do begin
    	if fc[i] = 0 then begin
    		fillchar(nc, sizeof(nc), 0);
    		if (c[i] <> 1) and bt(i, 1) then begin
    			dump;
    			continue;
    		end;
    		fillchar(nc, sizeof(nc), 0);
    		if (c[i] <> 2) and bt(i, 2) then begin
    			dump;
    			continue;
    		end;
    		fillchar(nc, sizeof(nc), 0);
    		if (c[i] <> 3) and bt(i, 3) then begin
    			dump;
    			continue;
    		end;
    		ok := false;
    		break;
    	end;
    end;		

    if not ok then
    	writeln('Impossible')
    else begin
    	for i := 1 to n do begin
    		write('RGB'[fc[i]]);
    	end;
    	writeln;
    end;

	close(input);
	close(output);
end.