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;
const int MAX_N = 1000005;
const int INF = 1000000000;
struct SegmentTree {
  int offset;
  vector<int> v;
  void initialize(int n, int a[]) {
    for (offset = 1; offset < n; offset <<= 1)
      ;
    v.resize(2 * offset, -INF);
    for (int i = 0; i < n; i++) {
      v[offset + i] = a[i];
    }
    for (int i = offset - 1; i > 0; i--) {
      v[i] = max(v[i * 2], v[i * 2 + 1]);
    }
  }
  int query(int x, int lo, int hi, int a, int b) {
    if (lo >= b || hi <= a) {
      return -INF;
    } else if (lo >= a && hi <= b) {
      return v[x];
    }
    return max(query(x * 2, lo, (lo + hi) / 2, a, b),
               query(x * 2 + 1, (lo + hi) / 2, hi, a, b));
  }
  int query(int a, int b) {
    if (a > b) {
      return -INF;
    }
    return query(1, 0, offset, a, b + 1);
  }
};
int n, c, xy[MAX_N][2], son[MAX_N];
int e[MAX_N][2];
SegmentTree sson;
vector<int> l[MAX_N], r[MAX_N];
void solve(int x, int y) {
  if (x >= y) {
    return;
  }
  if (xy[x][0] == x) {
    e[x][1] = x + 1;
    for (int i = 0; i < r[x].size(); i++) {
      if (r[x][i] < x + 1 || r[x][i] > y) {
        printf("IMPOSSIBLE\n");
        exit(0);
      }
    }
    solve(x + 1, y);
  } else if (xy[x][1] == n) {
    e[x][0] = x + 1;
    for (int i = 0; i < l[x].size(); i++) {
      if (l[x][i] < x + 1 || l[x][i] > y) {
        printf("IMPOSSIBLE\n");
        exit(0);
      }
    }
    solve(x + 1, y);
  } else {
    int a, m = 0;
    for (a = x + 1; a < y; a++) {
      m = max(m, son[a]);
      if (a >= xy[x][0] && m == a) {
        break;
      }
    }
    if (a >= y) {
      printf("IMPOSSIBLE\n");
      exit(0);
    }
    e[x][0] = x + 1;
    e[x][1] = a + 1;
    for (int i = 0; i < l[x].size(); i++) {
      if (l[x][i] < x + 1 || l[x][i] > a) {
        printf("IMPOSSIBLE\n");
        exit(0);
      }
    }
    for (int i = 0; i < r[x].size(); i++) {
      if (r[x][i] < a + 1 || r[x][i] > y) {
        printf("IMPOSSIBLE\n");
        exit(0);
      }
    }
    solve(x + 1, a);
    solve(a + 1, y);
  }
}
void print(int u) {
  if (u < 0 || u >= n) {
    return;
  }
  print(e[u][0]);
  printf("%d ", u + 1);
  print(e[u][1]);
}
int main() {
  scanf("%d %d", &n, &c);
  for (int i = 0; i < n; i++) {
    son[i] = i;
  }
  for (int i = 0; i < c; i++) {
    int u, v;
    char dir[10];
    scanf("%d %d %s", &u, &v, dir);
    --u, --v;
    son[u] = max(son[u], v);
    if (dir[0] == 'L') {
      l[u].push_back(v);
    } else {
      r[u].push_back(v);
    }
  }
  sson.initialize(n, son);
  for (int i = 0; i < n; i++) {
    sort(l[i].begin(), l[i].end());
    sort(r[i].begin(), r[i].end());
    int d = 0;
    for (int j = 0; j < l[i].size(); j++) {
      while (d < r[i].size() && r[i][d] < l[i][j]) {
        d++;
      }
      if (d < r[i].size() && r[i][d] == l[i][j]) {
        printf("IMPOSSIBLE\n");
        return 0;
      }
    }
    if (!l[i].empty() && (*l[i].begin()) <= i) {
      printf("IMPOSSIBLE\n");
      return 0;
    }
    if (!r[i].empty() && (*r[i].begin()) <= i) {
      printf("IMPOSSIBLE\n");
      return 0;
    }
    if (!l[i].empty() && !r[i].empty() && (*l[i].rbegin()) > (*r[i].begin())) {
      printf("IMPOSSIBLE\n");
      return 0;
    }
    if (l[i].empty()) {
      xy[i][0] = i;
    } else {
      xy[i][0] = (*l[i].rbegin());
    }
    if (r[i].empty()) {
      xy[i][1] = n;
    } else {
      xy[i][1] = (*r[i].begin());
    }
  }
  memset(e, -1, sizeof(e));
  solve(0, n - 1);
  print(0);
  printf("\n");
  return 0;
}