Problem: You need to find a binary tree of size n that satisfies a given set of c constraints. Suppose that the nodes of the unknown binary tree are labeled using a pre-order traversal starting with 1. For the i-th constraint you are given two labels, ai and bi and a direction, left or right. In case of left direction, bi is an element of the subtree rooted at ai's left child. Similarly in the case of right direction bi is an element of the subtree rooted at ai's right child.

Input

The first line of input contains two integers n and c. The next c lines contain 2 integers ai, bi (1 ≤ ai, bi ≤ n) and either "LEFT" or "RIGHT" denoting whether b is in the subtree rooted at ai's left child or in the subtree rooted at ai's right child.

The problem consists of multiple subproblems. The subproblems have different constraints on the input. You will get some score for the correct submission of the subproblem. The description of the subproblems follows.

  * In subproblem D1 (9 points), the constraints 1 ≤ n ≤ 100, 1 ≤ c ≤ 50 will hold. 
  * In subproblem D2 (8 points), the constraints 1 ≤ n ≤ 1000000, 1 ≤ c ≤ 100000 will hold. 

Output

Output will be on a single line.

Any binary tree that satisfies the constraints will be accepted. The tree's nodes should be printed out as n space separated labels representing an in-order traversal, using the pre-order numbers as labels of vertices.

If there are no trees that satisfy the constraints, print "IMPOSSIBLE" (without quotes).

Examples

Input

3 2
1 2 LEFT
1 3 RIGHT


Output

2 1 3


Input

3 2
1 2 RIGHT
1 3 LEFT


Output

IMPOSSIBLE

Note

Consider the first sample test. We need to find a tree with 3 nodes that satisfies the following two constraints. The node labeled 2 with pre-order traversal should be in the left subtree of the node labeled 1 with pre-order traversal; the node labeled 3 with pre-order traversal should be in the right subtree of the node labeled 1. There is only one tree with three nodes that satisfies these constraints and its in-order traversal is (2, 1, 3).

Pre-order is the "root – left subtree – right subtree" order. In-order is the "left subtree – root – right subtree" order.

For other information regarding in-order and pre-order, see <http://en.wikipedia.org/wiki/Tree_traversal>.

Solution (in JAVA):

Solution:
import java.io.*;

public class CF513D {

    static class Edge {
        int to;
        boolean left;

        public Edge(int to, boolean left) {
            this.to = to;
            this.left = left;
        }
    }

    static class ITree {
        int[] max;
        int size;

        ITree(int n) {
            size = 1;
            while (size < n) {
                size *= 2;
            }
            max = new int[2 * size - 1];
        }

        public int max(int l, int r) {
            return max(0, 0, size, l, r);
        }

        private int max(int n, int nl, int nr, int l, int r) {
            if (l <= nl && nr <= r) {
                return max[n];
            }
            if (nr <= l || r <= nl) {
                return -1;
            }
            int mid = (nl + nr) / 2;
            return Math.max(
                max(2 * n + 1, nl, mid, l, r),
                max(2 * n + 2, mid, nr, l, r));
        }

        public int set(int i, int val) {
            return set(0, 0, size, i, val);
        }

        private int set(int n, int nl, int nr, int i, int val) {
            if (i < nl || nr <= i) {
                return max[n];
            }
            if (nl + 1 == nr) {
                return max[n] = val;
            }
            int mid = (nl + nr) / 2;
            return max[n] = Math.max(
                set(2 * n + 1, nl, mid, i, val),
                set(2 * n + 2, mid, nr, i, val));
        }
    }

    public static void solve(Input in, PrintWriter out) throws IOException {
        int n = in.nextInt();
        int m = in.nextInt();
        int[] leftTo = new int[n];
        int[] rightFrom = new int[n];
        int[] rightTo = new int[n];
        for (int i = 0; i < n; ++i) {
            leftTo[i] = i + 1;
            rightFrom[i] = n;
            rightTo[i] = i + 1;
        }
        for (int i = 0; i < m; ++i) {
            int from = in.nextInt() - 1;
            int to = in.nextInt() - 1;
            if (from >= to) {
                out.println("IMPOSSIBLE");
                return;
            }
            if (in.next().equals("LEFT")) {
                leftTo[from] = Math.max(leftTo[from], to + 1);
            } else {
                rightFrom[from] = Math.min(rightFrom[from], to);
                rightTo[from] = Math.max(rightTo[from], to + 1);
            }
        }
        ITree t = new ITree(n);
        for (int i = n - 1; i >= 0; --i) {
            int val = t.max(i + 1, Math.max(leftTo[i], rightTo[i]));
            val = Math.max(val, i + 1);
            t.set(i, val);
        }
        for (int i = 0; i < n; ++i) {
            leftTo[i] = Math.max(i + 1, t.max(i + 1, leftTo[i]));
            if (leftTo[i] > rightFrom[i]) {
                out.println("IMPOSSIBLE");
                return;
            }
            rightFrom[i] = leftTo[i];
            rightTo[i] = Math.max(rightFrom[i], t.max(rightFrom[i], rightTo[i]));
        }
        print(out, leftTo, 0, n);
        out.println();
    }

    private static void print(PrintWriter out, int[] leftTo, int i, int to) {
        if (leftTo[i] > i + 1) {
            print(out, leftTo, i + 1, leftTo[i]);
        }
        out.print((i + 1) + " ");
        if (to > leftTo[i]) {
            print(out, leftTo, leftTo[i], to);
        }
    }

    public static void main(String[] args) throws IOException {
        PrintWriter out = new PrintWriter(System.out);
        solve(new Input(new BufferedReader(new InputStreamReader(System.in))), out);
        out.close();
    }

    static class Input {
        BufferedReader in;
        StringBuilder sb = new StringBuilder();

        public Input(BufferedReader in) {
            this.in = in;
        }

        public Input(String s) {
            this.in = new BufferedReader(new StringReader(s));
        }

        public String next() throws IOException {
            sb.setLength(0);
            while (true) {
                int c = in.read();
                if (c == -1) {
                    return null;
                }
                if (" \n\r\t".indexOf(c) == -1) {
                    sb.append((char)c);
                    break;
                }
            }
            while (true) {
                int c = in.read();
                if (c == -1 || " \n\r\t".indexOf(c) != -1) {
                    break;
                }
                sb.append((char)c);
            }
            return sb.toString();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }
    }
}