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.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.math.BigInteger;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Vadim Semenov
 */
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);
		TaskD2 solver = new TaskD2();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD2 {
    private static final String IMPOSSIBLE = "IMPOSSIBLE";
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int counter = in.nextInt();
        int[] maxChild = new int[counter];
        int[] maxLeftChild = new int[counter];
        for (int i = 0; i < counter; ++i) maxChild[i] = maxLeftChild[i] = i;
        int restrictions = in.nextInt();
        int[] parents = new int[restrictions];
        int[] children = new int[restrictions];
        boolean[] needCheck = new boolean[restrictions];
        for (int i = 0; i < restrictions; ++i) {
            parents[i] = in.nextInt() - 1;
            children[i] = in.nextInt() - 1;
            if (children[i] <= parents[i]) {
                out.println(IMPOSSIBLE);
                return;
            }
            String direction = in.next();
            if (direction.equals("LEFT")) {
                maxLeftChild[parents[i]] = Math.max(maxLeftChild[parents[i]], children[i]);
            } else if (direction.equals("RIGHT")) {
                needCheck[i] = true;
            } else throw new AssertionError(direction);
            maxChild[parents[i]] = Math.max(maxChild[parents[i]], children[i]);
        }
        {
            int[] stack = new int[counter];
            int top = 0;
            for (int i = counter - 1; i >= 0; --i) {
                int lastTop = top;
                while (top > 0 && stack[top - 1] <= maxChild[i]) {
                    if (stack[top - 1] <= maxLeftChild[i]) {
                        maxLeftChild[i] = Math.max(maxLeftChild[i], maxChild[stack[top - 1]]);
                    }
                    maxChild[i] = Math.max(maxChild[i], maxChild[stack[top - 1]]);
                    top--;
                }
                while (lastTop > top) {
                    if (maxChild[stack[lastTop - 1]] <= maxLeftChild[i]) {
                        maxChild[stack[lastTop - 1]] = maxLeftChild[i];
                    } else {
                        maxChild[stack[lastTop - 1]] = maxChild[i];
                    }
                    lastTop--;
                }
                stack[top++] = i;
            }
//            System.err.println(Arrays.toString(maxChild));
//            System.err.println(Arrays.toString(maxLeftChild));
        }
        for (int i = 0; i < restrictions; ++i) {
            if (needCheck[i]) {
                if (!(maxLeftChild[parents[i]] < children[i] && children[i] <= maxChild[parents[i]])) {
                    out.println(IMPOSSIBLE);
                    return;
                }
            }
        }
        int[] answer = new int[counter];
        int[] succ = new int[counter];
        int[] pred = new int[counter];
        for (int i = 0; i < counter; ++i) {
            succ[i] = i + 1;
            pred[i] = i - 1;
        }
        for (int i = 0, ptr = 0; i < counter; i++) {
            int idx = ptr + (maxLeftChild[i] - i);
            answer[idx] = i + 1;
            if (pred[idx] >= 0) {
                succ[pred[idx]] = succ[idx];
            }
            if (succ[idx] < counter) {
                pred[succ[idx]] = pred[idx];
            }
            if (maxLeftChild[i] == i) {
                ptr = succ[ptr];
            }
        }
        for (int i = 0; i < counter; ++i) {
            if (i > 0) out.print(' ');
            out.print(answer[i]);
        }
        out.println();
    }
}

class InputReader {
    private final BufferedReader reader;
    private StringTokenizer tokenizer;

    public InputReader(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
    }

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

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(readLine());
        }
        return tokenizer.nextToken();
    }

    public String readLine() {
        String line;
        try {
            line = reader.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        return line;
    }
}