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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author George Marcus
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD1 solver = new TaskD1();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD1 {
        int N;
        ArrayList<Integer>[] left;
        ArrayList<Integer>[] right;
        int[] pre;
        int K;
        int[] ans;
        int Q;
        boolean OK;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            N = in.nextInt();
            int C = in.nextInt();
            left = new ArrayList[N];
            right = new ArrayList[N];
            for (int i = 0; i < N; i++) {
                left[i] = new ArrayList<Integer>();
                right[i] = new ArrayList<Integer>();
            }
            while (C-- > 0) {
                int a = in.nextInt();
                int b = in.nextInt();
                String dir = in.nextString();
                a--;
                b--;
                if (dir.equals("LEFT")) {
                    left[a].add(b);
                } else {
                    right[a].add(b);
                }
            }

            pre = new int[N];
            ans = new int[N];
            K = 0;
            Q = 0;
            OK = true;
            go(0, 0, N - 1);

            if (!OK) {
                out.println("IMPOSSIBLE");
                return;
            }

            for (int i = 0; i < N; i++) {
                if (i > 0) {
                    out.print(" ");
                }
                out.print(ans[i] + 1);
            }
            out.println();
        }

        private void go(int node, int lower, int upper) {
            if (lower > upper || node > upper) {
                OK = false;
            }
            if (!OK) {
                return;
            }
            pre[K++] = node;

            int leftMax = 0;
            for (int x : left[node]) {
                if (x <= node) {
                    OK = false;
                    return;
                }
                leftMax = Math.max(leftMax, x);
            }

            int rightMin = 10000000;
            int rightMax = 0;
            for (int x : right[node]) {
                if (x <= node) {
                    OK = false;
                    return;
                }
                rightMin = Math.min(rightMin, x);
                rightMax = Math.max(rightMax, x);
            }

            if (leftMax >= rightMin) {
                OK = false;
                return;
            }

            if (left[node].isEmpty() && right[node].isEmpty()) {
                int crt = node;
                while (((upper == N - 1 && crt < upper) || crt < lower) &&
                        left[crt].isEmpty() && right[crt].isEmpty()) {
                    crt++;
                }
                if (crt == node) {
                    ans[Q++] = node;
                } else {
                    for (int i = node + 1; i < crt; i++) {
                        pre[K++] = i;
                    }
                    if ((upper == N - 1 && crt - 1 < upper) || crt - 1 < lower) {
                        go(crt, lower, upper);
                    }
                    for (int i = crt - 1; i >= node; i--) {
                        ans[Q++] = i;
                    }
                }
            } else if (right[node].isEmpty()) {
                int nlower = Math.max(lower, leftMax);
                go(node + 1, nlower, upper);
                ans[Q++] = node;
            } else if (left[node].isEmpty()) {
                ans[Q++] = node;
                int nlower = Math.max(lower, rightMax);
                go(node + 1, nlower, upper);
            } else {
                int nupper = Math.min(upper, rightMin - 1);
                go(node + 1, leftMax, nupper);
                ans[Q++] = node;
                int next = pre[K - 1] + 1;
                int nlower = Math.max(lower, rightMax);
                go(next, nlower, upper);
            }
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            return Integer.parseInt(nextString());
        }

        public String nextString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuffer res = new StringBuffer();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));

            return res.toString();
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}