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 CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
int n, Q, w[1010000][3], P[1010000], L[1010000], Ed[1010000];
int C[1010000][2], ck;
int IT[2100000];
void Add(int a, int b) {
  a += 1048576;
  IT[a] = b;
  while (a != 1) {
    a >>= 1;
    IT[a] = max(IT[a + a], IT[a + a + 1]);
  }
}
int Max(int b, int e) {
  b += 1048576, e += 1048576;
  int r = 0;
  while (b <= e) {
    r = max(r, IT[b]);
    r = max(r, IT[e]);
    b = (b + 1) >> 1;
    e = (e - 1) >> 1;
  }
  return r;
}
void DFS(int a, int ed) {
  Ed[a] = ed;
  int t = a + 1;
  if (a == ed) return;
  if (L[a]) {
    C[a][0] = a + 1;
    t = Max(a + 1, L[a]);
    if (t > ed) {
      ck = 1;
      return;
    }
    DFS(a + 1, t);
    if (ck) return;
    t++;
  }
  if (t != ed + 1) {
    C[a][1] = t;
    if (P[t] > ed) {
      ck = 1;
      return;
    }
    DFS(C[a][1], ed);
    if (ck) return;
  }
}
bool Par(int a, int b) {
  if (!a) return false;
  if (a > b) return false;
  return b <= Ed[a];
}
void DFS2(int a) {
  if (C[a][0]) {
    DFS2(C[a][0]);
  }
  printf("%d ", a);
  if (C[a][1]) {
    DFS2(C[a][1]);
  }
}
int main() {
  int i;
  char p[20];
  scanf("%d%d", &n, &Q);
  for (i = 1; i <= n; i++) P[i] = i;
  for (i = 1; i <= Q; i++) {
    scanf("%d%d", &w[i][0], &w[i][1]);
    scanf("%s", p);
    if (p[0] == 'L')
      w[i][2] = 1;
    else
      w[i][2] = 2;
    if (w[i][0] >= w[i][1]) {
      printf("IMPOSSIBLE\n");
      return 0;
    }
    if (P[w[i][0]] < w[i][1]) P[w[i][0]] = w[i][1];
    if (w[i][2] == 1 && L[w[i][0]] < w[i][1]) L[w[i][0]] = w[i][1];
  }
  for (i = 1; i <= n; i++) {
    Add(i, P[i]);
  }
  for (i = n; i >= 1; i--) {
    P[i] = Max(i, P[i]);
    Add(i, P[i]);
  }
  DFS(1, n);
  if (ck) {
    printf("IMPOSSIBLE\n");
    return 0;
  }
  for (i = 1; i <= Q; i++) {
    if (w[i][2] == 1) {
      if (!Par(C[w[i][0]][0], w[i][1])) {
        printf("IMPOSSIBLE\n");
        return 0;
      }
    } else {
      if (!Par(C[w[i][0]][1], w[i][1])) {
        printf("IMPOSSIBLE\n");
        return 0;
      }
    }
  }
  DFS2(1);
  return 0;
}