import java.util.Collection;
import java.util.ArrayList;
import java.util.Scanner;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.io.File;

public class color_petr {
    static class Graph {
        public class Vertex {
            public Collection<Vertex> edges;
            public Collection<Vertex> inverseEdges;
            public boolean visited;
            public Collection<Vertex> component;
            public TwoSAT.Variable variable;
            public boolean variableValue;

            public Vertex() {
                edges = new ArrayList<Vertex>();
                inverseEdges = new ArrayList<Vertex>();
                visited = false;
                component = null;
                variable = null;
                variableValue = false;
            }
        }

        public Collection<Vertex> vertices;

        public Graph() {
            vertices = new ArrayList<Vertex>();
        }

        public Vertex AddVertex() {
            Vertex vertex = new Vertex();
            vertices.add(vertex);
            return vertex;
        }

        public void AddEdge(Vertex source, Vertex destination) {
            source.edges.add(destination);
            destination.inverseEdges.add(source);
        }

        void dfs(Vertex root, Collection<Vertex> exitOrder) {
            if (root.visited)
                return;

            root.visited = true;

            for (Vertex next: root.edges)
                dfs(next, exitOrder);

            exitOrder.add(root);
        }

        void inverseDfs(Vertex root, Collection<Vertex> currentComponent) {
            if (root.visited)
                return;

            root.visited = true;
            currentComponent.add(root);
            root.component = currentComponent;

            for (Vertex next: root.inverseEdges)
                inverseDfs(next, currentComponent);
        }

        public ArrayList<ArrayList<Vertex>> GetStronglyConnectedComponents() {
            ArrayList<ArrayList<Vertex>> components = new ArrayList<ArrayList<Vertex>>();

            for (Vertex vertex: vertices) {
                vertex.visited = false;
            }

            ArrayList<Vertex> exitOrder = new ArrayList<Vertex>(vertices.size());

            for (Vertex vertex: vertices) {
                if (!vertex.visited)
                    dfs(vertex, exitOrder);
            }

            for (Vertex vertex: vertices) {
                vertex.visited = false;
            }

            for (int i = exitOrder.size() - 1; i >= 0; --i) {
                Vertex vertex = exitOrder.get(i);

                if (!vertex.visited) {
                    ArrayList<Vertex> currentComponent = new ArrayList<Vertex>();

                    inverseDfs(vertex, currentComponent);

                    components.add(currentComponent);
                }
            }

            return components;
        }
    }


    static class TwoSAT {
        public class Variable {
            public Graph.Vertex trueVertex;
            public Graph.Vertex falseVertex;
            public Boolean value;
            public Color trueColor;
            public Color falseColor;

            public Variable(Graph.Vertex trueVertex, Graph.Vertex falseVertex) {
                this.trueVertex = trueVertex;
                this.falseVertex = falseVertex;

                trueVertex.variable = this;
                falseVertex.variable = this;
                trueVertex.variableValue = true;
                falseVertex.variableValue = false;

                value = null;
            }

            public Graph.Vertex GetVertex(boolean value) {
                if (value)
                    return trueVertex;
                else
                    return falseVertex;
            }

            public Color GetColor(boolean value) {
                if (value)
                    return trueColor;
                else
                    return falseColor;
            }
        }

        public Collection<Variable> variables;

        Graph graph;

        public TwoSAT() {
            variables = new ArrayList<Variable>();
            graph = new Graph();
        }

        public Variable AddVariable() {
            Graph.Vertex trueVertex = graph.AddVertex();
            Graph.Vertex falseVertex = graph.AddVertex();

            Variable variable = new Variable(trueVertex, falseVertex);

            variables.add(variable);

            return variable;
        }

        public void AddRestriction(Variable first, boolean firstValue, Variable second, boolean secondValue) {
            graph.AddEdge(first.GetVertex(!firstValue), second.GetVertex(secondValue));
            graph.AddEdge(second.GetVertex(!secondValue), first.GetVertex(firstValue));
        }

        public boolean Solve() {
            for (Variable variable: variables) {
                variable.value = null;
            }

            ArrayList<ArrayList<Graph.Vertex>> components = graph.GetStronglyConnectedComponents();

            for (int i = components.size() - 1; i >= 0; --i) {
                ArrayList<Graph.Vertex> component = components.get(i);

                if (component.get(0).variable.value != null)
                    continue;

                for (Graph.Vertex vertex : component) {
                    if (vertex.variable.value != null)
                        return false;

                    vertex.variable.value = vertex.variableValue;
                }
            }

            return true;
        }
    }

    enum Color {
        R,
        G,
        B;

        public Color NextColor() {
            switch (this) {
                case R:
                    return G;

                case G:
                    return B;

                case B:
                    return R;

                default:
                    return null;
            }
        }
    }

    public static void main(String[] args) throws FileNotFoundException {
        Scanner scanner = new Scanner(new File("color.in"));
        PrintWriter writer = new PrintWriter(new FileOutputStream("color.out"));

        int numVertices = scanner.nextInt();
        int numEdges = scanner.nextInt();

        TwoSAT.Variable[] variables = new TwoSAT.Variable[numVertices];

        TwoSAT twoSAT = new TwoSAT();

        scanner.nextLine();

        String s = scanner.nextLine();

        for (int i = 0; i < variables.length; i++) {
            Color color = Color.valueOf("" + s.charAt(i));

            variables[i] = twoSAT.AddVariable();

            variables[i].trueColor = color.NextColor();
            variables[i].falseColor = color.NextColor().NextColor();
        }

        for (int i = 0; i < numEdges; i++) {
            TwoSAT.Variable first = variables[scanner.nextInt() - 1];
            TwoSAT.Variable second = variables[scanner.nextInt() - 1];

            for (boolean firstValue = false; true; firstValue = true) {
                for (boolean secondValue = false; true; secondValue = true) {
                    if (first.GetColor(firstValue) == second.GetColor(secondValue)) {
                        twoSAT.AddRestriction(first, !firstValue, second, !secondValue);
                    }

                    if (secondValue)
                        break;
                }

                if (firstValue)
                    break;
            }
        }

        if (twoSAT.Solve()) {
            for (TwoSAT.Variable variable : variables) {
                writer.print(variable.GetColor(variable.value));
            }
            writer.println();
        }
        else
        {
            writer.println("Impossible");
        }

        writer.close();
    }
}
