import java.util.*;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.io.FileOutputStream;

public class color_pm {

    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 n = scanner.nextInt();
        int m = scanner.nextInt();

        Vertex[] v = new Vertex[n];

        scanner.nextLine();

        String s = scanner.nextLine();

        for (int i = 0; i < v.length; i++) {
            v[i] = new Vertex(Color.valueOf("" + s.charAt(i)));
        }

        for (int i = 0; i < m; i++) {
            int a = scanner.nextInt();
            int b = scanner.nextInt();
            v[a - 1].neigbours.add(v[b - 1]);
            v[b - 1].neigbours.add(v[a - 1]);
        }

        for (int i = 0; i < n; i++) {
            if (v[i].newColor == null) {
                for (Color color : Color.values()) {
                    for (Vertex vertex : v) {
                        vertex.marked = false;
                    }
                    if (v[i].trySet(color)) {
                        break;
                    }
                }
            }
        }
        boolean ok = true;
        for (Vertex vertex : v) {
            if (vertex.newColor == null) {
                ok = false;
            }
        }
        if (ok) {
            for (Vertex vertex : v) {
                writer.print(vertex.newColor);
            }
        } else {
            writer.println("Impossible");

        }
        writer.close();
    }

    static class Vertex {
        Color prevColor;
        Color newColor;
        Collection<Vertex> neigbours;
        boolean marked;

        public Vertex(Color prevColor) {
            this.prevColor = prevColor;
            neigbours = new ArrayList<Vertex>();
        }

        boolean trySet(Color color) {
            marked = true;
            if (color == prevColor) {
                return false;
            } else {
                Color c = newColor;
                newColor = color;
                boolean ok = true;
                for (Vertex v : neigbours) {
                    if (v.marked) {
                        if (v.newColor == color) {
                            ok = false;
                        }
                    } else {
                        if (v.prevColor != color) {
                            if (!v.trySet(Color.getNot(v.prevColor, color))) {
                                ok = false;
                            }
                        }
                    }
                }
                if (!ok) {
                    newColor = c;
                }
                return ok;
            }
        }
    }

    enum Color {
        R,
        G,
        B;

        public static Color getNot(Color c1, Color c2) {
            for (Color color : Color.values()) {
                if (color != c1 && color != c2) {
                    return color;
                }
            }
            return null;
        }
    }
}
