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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class D {



    private void solve() throws IOException {
        int n = nextInt();
        int c = nextInt();

        int[] maxLeft = new int[n];
        int[] minLeft = new int[n];
        int[] minRight = new int[n];
        int[] maxRight = new int[n];
        Arrays.fill(maxLeft, -1);
        Arrays.fill(maxRight, -1);
        Arrays.fill(minLeft, Integer.MAX_VALUE);
        Arrays.fill(minRight, Integer.MAX_VALUE);

        for (int i = 0; i < c; i++) {
            int a = nextInt() - 1;
            int b = nextInt() - 1;
            if (a >= b) {
                println("IMPOSSIBLE");
                return;
            }
            String s = nextToken();
            if ("LEFT".equals(s)) {
                maxLeft[a] = Math.max(maxLeft[a], b);
                minLeft[a] = Math.min(minLeft[a], b);
            } else {
                minRight[a] = Math.min(minRight[a], b);
                maxRight[a] = Math.max(maxRight[a], b);
            }
        }

        List<Integer> res = new ArrayList<>();
        if (!f(0, n - 1, res, maxLeft, maxRight, minLeft, minRight)) {
            println("IMPOSSIBLE");
        } else {
            for (int i: res) {
                print((i + 1) + " ");
            }
        }
    }

    int[] max = new int[1000100];
    int[] min = new int[1000100];
    private boolean f(int l, int r, List<Integer> res, int[] maxLeft, int[] maxRight, int[] minLeft, int[] minRight) {
        if (l > r) {
            return true;
        } else if (maxRight[l] == -1) {
            boolean b = f(l + 1, r, res, maxLeft, maxRight, minLeft, minRight);
            res.add(l);
            return b;
        } else if (maxLeft[l] == -1) {
            res.add(l);
            return f(l + 1, r, res, maxLeft, maxRight, minLeft, minRight);
        } else {

            int max1 = maxLeft[l];
            int min1 = minRight[l];
            for (int i = l + 1; i < minRight[l]; i++) {
                max1 = Math.max(max1, maxLeft[i]);
                max1 = Math.max(max1, maxRight[i]);
                max[i] = max1;
            }

            for (int i = r; i > maxLeft[l]; i--) {
                min1 = Math.min(min1, minLeft[i]);
                min1 = Math.min(min1, minRight[i]);
                min[i] = min1;
            }

            int best = (l + 1 + r) / 2;
            int x = -1;
            for (int i = maxLeft[l]; i < minRight[l]; i++) {
                if (max[i] <= i && min[i + 1] >= i + 1) {
                    if (x == -1 || Math.abs(i - best) < best - x) {
                        x = i;
                    }
                    if (x >= best) {
                        break;
                    }

                }
            }

            if (x != -1) {
                boolean b = f(l + 1, x, res, maxLeft, maxRight, minLeft, minRight);
                res.add(l);
                b &= f(x + 1, r, res, maxLeft, maxRight, minLeft, minRight);
                return b;
            }

            return false;
        }
    }

    private String nextToken() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }

    private int nextInt() throws NumberFormatException, IOException {
        return Integer.parseInt(nextToken());
    }

    private double nextDouble() throws NumberFormatException, IOException {
        return Double.parseDouble(nextToken());
    }

    private long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    private void print(Object o) {
        writer.print(o);
    }

    private void println(Object o) {
        writer.println(o);
    }

    private void printf(String format, Object... o) {
        writer.printf(format, o);
    }

    public static void main(String[] args) {
        long time = System.currentTimeMillis();
        Locale.setDefault(Locale.US);
        new D().run();
        System.err.printf("%.3f\n", 1e-3 * (System.currentTimeMillis() - time));
    }

    BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter writer;

    private void run() {
        try {
            reader = new BufferedReader(new InputStreamReader(System.in));
            writer = new PrintWriter(System.out);
            solve();
            reader.close();
            writer.close();
        } catch (IOException e) {
            e.printStackTrace();
            System.exit(13);
        }
    }
}