{$apptype CONSOLE}

const
	IN_FILE = 'color.in';
	OUT_FILE = 'color.out';
	
	MAX_N = 2000;
	MAX_M = 30000;
	
	colNames : string = 'RGB';

var
	n : integer;
	deg : array[1..MAX_N] of integer;
	e : array[1..MAX_N,1..MAX_N] of integer;
	cols, answer : array[1..MAX_N] of integer;

	hassol : boolean;	
	hascol : array[1..MAX_N] of boolean;

function EncodeColor(c : char) : integer;
var	
	i : integer;
	
begin
	for i := 1 to 3 do
		if colNames[i] = c then
			result := i;
end;

function DecodeColor(c : integer) : char;
begin
	result := colNames[c];
end;	
		
procedure ReadInput;
var
	i, m : integer;
	u, v : integer;
	ch : char;

begin
	reset(input, IN_FILE);
	readln(n, m);
	for i := 1 to n do begin
		read(ch);
		cols[i] := EncodeColor(ch);
	end;	
	for i := 1 to m do begin
		read(u, v);
		inc(deg[u]);
		e[u,deg[u]] := v;
		inc(deg[v]);
		e[v,deg[v]] := u;
	end;
	close(input);	
end;

procedure WriteOutput;
var
	i : integer;
	
begin
	rewrite(output, OUT_FILE);
	if hassol then begin
		for i := 1 to n do
			write(DecodeColor(answer[i]));
		writeln;
	end else
		writeln('Impossible');	
	close(output);
end;

function Rec(i : integer) : boolean;
var
	cf : array[1..3] of boolean;
	c, j, k, next : integer;
		
begin
	result := true;
	
	fillchar(cf, sizeof(cf), false);
    cf[cols[i]] := true;
	for j := 1 to deg[i] do begin
		k := e[i,j];
		if hascol[k] then
			cf[answer[k]] := true;
	end;

	for	c := 1 to 3 do
		if not cf[c] then begin
			hascol[i] := true;
			answer[i] := c;
			
			next := 0;
			for j := 1 to deg[i] do begin
				k := e[i,j];
				if not hascol[k] then begin
					next := k;
					break;
				end;	
			end;
			
			if next = 0 then begin
				for k := 1 to n do
					if not hascol[k] then begin
						next := k;
						break;
					end;	
			end;
			
			if next = 0 then
				exit;
				
			if Rec(next) then
            	exit;
			
			hascol[i] := false;
		end;
		
	result := false;	
end;

procedure Solve;
begin
	fillchar(hascol, sizeof(hascol), false);
	answer := cols;
	hassol := Rec(1);
end;

begin
	ReadInput;
	Solve;
	WriteOutput;
end.
