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;
template <class T>
inline void amin(T &a, T b) {
  if (a > b) a = b;
}
template <class T>
inline void amax(T &a, T b) {
  if (a < b) a = b;
}
const pair<int, int> INF = make_pair(1 << 29, -1);
struct AddMinimum {
  pair<int, int> add(const pair<int, int> &x, const pair<int, int> &y) {
    return make_pair(x.first + y.first, x.second);
  }
  int n, m;
  vector<pair<int, int> > all, data;
  AddMinimum(int n = 0) : n(n) {
    m = 1;
    for (; m < n;) m *= 2;
    all = data = vector<pair<int, int> >(m * 2, make_pair(0, -1));
    for (int i = 0; i < m; i++) data[i + m].second = i;
    for (int i = m; --i;) data[i] = min(data[i * 2], data[i * 2 + 1]);
  }
  void add(int x, int y, int v) { add(x, y, 1, 0, m, make_pair(v, -1)); }
  void add(int x, int y, int k, int l, int r, pair<int, int> v) {
    if (x <= l && r <= y) {
      all[k] = add(all[k], v);
      return;
    } else if (x < r && l < y) {
      add(x, y, k * 2, l, (l + r) / 2, v);
      add(x, y, k * 2 + 1, (l + r) / 2, r, v);
      data[k] = min(add(data[k * 2], all[k * 2]),
                    add(data[k * 2 + 1], all[k * 2 + 1]));
    }
  }
  pair<int, int> minimum(int x, int y) { return minimum(x, y, 1, 0, m); }
  pair<int, int> minimum(int x, int y, int k, int l, int r) {
    if (r <= x || y <= l) return INF;
    if (x <= l && r <= y) return add(data[k], all[k]);
    return add(min(minimum(x, y, k * 2, l, (l + r) / 2),
                   minimum(x, y, k * 2 + 1, (l + r) / 2, r)),
               all[k]);
  }
};
int N, C;
int A[100011], B[100011];
bool LE[100011];
char buf[99];
vector<int> ML[1000011], MR[1000011];
vector<int> MM;
int L[1000011], R[1000011];
vector<int> ans;
AddMinimum X;
bool rec(int p, int q) {
  if (p == q) {
    ans.push_back(p);
    return true;
  }
  for (__typeof((MR[p]).begin()) e = (MR[p]).begin(), e_end = (MR[p]).end();
       e != e_end; ++e) {
    X.add(p + 1, *e + 1, -1);
    X.add(*e + 1, N + 2, 1);
    MM.push_back(*e);
  }
  pair<int, int> t = X.minimum(p + 1, q + 2);
  if (t.first != 0) return false;
  for (__typeof((ML[p]).begin()) e = (ML[p]).begin(), e_end = (ML[p]).end();
       e != e_end; ++e) {
    X.add(p + 1, *e + 1, -1);
  }
  for (__typeof((MM).begin()) e = (MM).begin(), e_end = (MM).end(); e != e_end;
       ++e) {
    X.add(*e + 1, N + 2, -1);
  }
  MM.clear();
  const int i = t.second;
  bool tmp = true;
  if (i != p + 1) {
    L[p] = p + 1;
    tmp = (tmp && rec(p + 1, i - 1));
  }
  ans.push_back(p);
  if (i != q + 1) {
    R[p] = i;
    tmp = (tmp && rec(i, q));
  }
  return tmp;
}
int main() {
  scanf("%d%d", &N, &C);
  X = AddMinimum(N + 2);
  for (int i = 0, i_len = (C); i < i_len; ++i) {
    scanf("%d%d%s", A + i, B + i, buf);
    if (A[i] >= B[i]) {
      puts("IMPOSSIBLE");
      return 0;
    }
    if (buf[0] == 'L') LE[i] = true;
    if (LE[i]) {
      ML[A[i]].push_back(B[i]);
      X.add(A[i] + 1, B[i] + 1, 1);
    } else {
      MR[A[i]].push_back(B[i]);
      X.add(A[i] + 1, B[i] + 1, 1);
    }
  }
  bool ok = rec(1, N);
  if (!ok)
    puts("IMPOSSIBLE");
  else {
    for (int i = 0, i_len = (N); i < i_len; ++i)
      printf("%d%c", ans[i], i + 1 == N ? '\n' : ' ');
  }
  cerr << X.minimum(1, N + 1).first << "\n";
  return 0;
}