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>
void debug(T a, T b) {
  ;
}
template <class T>
void chmin(T& a, const T& b) {
  if (a > b) a = b;
}
template <class T>
void chmax(T& a, const T& b) {
  if (a < b) a = b;
}
namespace std {
template <class S, class T>
ostream& operator<<(ostream& out, const pair<S, T>& a) {
  out << '(' << a.first << ',' << a.second << ')';
  return out;
}
}  // namespace std
long long int readL() {
  long long int res;
  scanf("%I64d", &res);
  return res;
}
void printL(long long int res) { printf("%I64d", res); }
const int INF = 5e8;
int n, c;
int ch[1000005][2];
void imp() {
  puts("IMPOSSIBLE");
  exit(0);
}
vector<int> sub[1000005][2];
int maxi[1000005], divi[1000005];
void dfs(int v, int p, int till) {
  if (divi[v] == v + 1) {
    if (v + 1 < till) {
      ch[v][1] = v + 1;
      dfs(v + 1, v, till);
    }
  } else if (v + 1 < till) {
    ch[v][0] = v + 1;
    dfs(v + 1, v, min(till, divi[v]));
    if (divi[v] < till) {
      ch[v][1] = divi[v];
      dfs(divi[v], v, till);
    }
  }
}
void dfs2(int v) {
  int L = ch[v][0], R = ch[v][1];
  if (~L) dfs2(L);
  printf("%d ", v + 1);
  if (~R) dfs2(R);
}
bool check(int v, int c) {
  if (v == -1) return false;
  if (v == c) return true;
  int L = ch[v][0], R = ch[v][1];
  if (~L && check(L, c)) return true;
  if (~R && check(R, c)) return true;
  return false;
}
struct segtree {
  static const int MAX_N = 2200000;
  int val[MAX_N];
  int n;
  void init(int n_) {
    n = 1;
    while (n < n_) n <<= 1;
    for (int i = 0; i < (n * 2); ++i) val[i] = INF;
  }
  void set(int k, int a) {
    k += n - 1;
    val[k] = a;
    while (k > 0) {
      k = (k - 1) / 2;
      val[k] = min(val[k * 2 + 1], val[k * 2 + 2]);
    }
  }
  int query(int a, int b, int i, int l, int r) {
    if (a <= l && r <= b) return val[i];
    if (b <= l || r <= a) return INF;
    int md = (l + r) >> 1;
    return min(query(a, b, i * 2 + 1, l, md), query(a, b, i * 2 + 2, md, r));
  }
};
segtree seg;
int main() {
  cin >> n >> c;
  char tmp[10];
  memset(ch, -1, sizeof(ch));
  for (int i = 0; i < (c); ++i) {
    int a, b;
    scanf("%d%d%s", &a, &b, tmp);
    --a;
    --b;
    int t;
    if (a >= b) imp();
    if (tmp[0] == 'L')
      t = 0;
    else
      t = 1;
    if (a >= b) imp();
    sub[a][t].push_back(b);
  }
  seg.init(n);
  for (int i = n - 1; i >= 0; --i) {
    maxi[i] = i;
    int Lmaxi = i;
    for (int t = 0; t < (2); ++t) {
      sort((sub[i][t]).begin(), (sub[i][t]).end());
      for (auto e : sub[i][t]) {
        if (t == 0) chmax(Lmaxi, maxi[e]);
        chmax(maxi[i], maxi[e]);
      }
    }
    chmax(maxi[i], -seg.query(i, maxi[i] + 1, 0, 0, seg.n));
    seg.set(i, -maxi[i]);
    ;
    ;
    chmax(Lmaxi, -seg.query(i + 1, Lmaxi + 1, 0, 0, seg.n));
    if (!sub[i][1].empty() && Lmaxi >= sub[i][1][0]) imp();
    divi[i] = Lmaxi + 1;
  };
  ;
  debug(maxi, maxi + n);
  debug(divi, divi + n);
  debug(maxi, maxi + n);
  dfs(0, -1, n);
  dfs2(0);
  putchar('\n');
  return 0;
}