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 <typename T>
T gcd(T x, T y) {
  while (y > 0) {
    x %= y;
    swap(x, y);
  }
  return x;
}
template <class _T>
inline _T sqr(const _T& x) {
  return x * x;
}
template <class _T>
inline string tostr(const _T& a) {
  ostringstream os("");
  os << a;
  return os.str();
}
const long double PI = 3.1415926535897932384626433832795L;
template <typename T>
inline void input(T& a) {
  static int c;
  a = 0;
  while (!isdigit(c = getchar()) && c != '-') {
  }
  char neg = 0;
  if (c == '-') {
    neg = 1;
    c = getchar();
  }
  while (isdigit(c)) {
    a = 10 * a + c - '0';
    c = getchar();
  }
  if (neg) a = -a;
}
template <typename T = int>
inline T nxt() {
  T res;
  input(res);
  return res;
}
void solve() {}
void imp() {
  puts("IMPOSSIBLE");
  exit(0);
}
const int N = 1000010;
vector<int> q[N][2];
int g[N][2];
int r[N];
int maleft[N];
int miright[N];
int n;
int dfs(int v, int le, int ri) {
  if (r[v] >= ri) {
    imp();
  }
  if (v >= ri) {
    imp();
  }
  if (le >= ri) {
    imp();
  }
  if (maleft[v] > v) {
    g[v][0] = v + 1;
    int ret = dfs(v + 1, maleft[v], min(ri, miright[v]));
    le = max(le, r[v]);
    if (ret < le) {
      g[v][1] = ret + 1;
      return dfs(ret + 1, le, ri);
    } else {
      return ret;
    }
  } else {
    le = max(le, r[v]);
    if (v < le) {
      g[v][1] = v + 1;
      return dfs(v + 1, le, ri);
    }
  }
  return v;
}
void print(int v) {
  if (v >= n) {
    return;
  }
  if (g[v][0]) {
    print(g[v][0]);
  }
  printf("%d ", v + 1);
  if (g[v][1]) {
    print(g[v][1]);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int c;
  n = nxt();
  c = nxt();
  char s[10];
  for (int i = 0; i < c; ++i) {
    int a = nxt() - 1;
    int b = nxt() - 1;
    if (b <= a) {
      imp();
    }
    scanf("%s", s);
    if (s[0] == 'L') {
      q[a][0].push_back(b);
    } else {
      q[a][1].push_back(b);
    }
  }
  for (int i = 0; i < n; ++i) {
    r[i] = i;
    maleft[i] = i;
    miright[i] = INT_MAX;
  }
  for (int i = n - 2; i >= 0; --i) {
    for (int x : q[i][0]) {
      r[i] = max(r[i], r[x]);
    }
    for (int x : q[i][1]) {
      r[i] = max(r[i], r[x]);
    }
    for (int x : q[i][0]) {
      maleft[i] = max(maleft[i], r[x]);
    }
    for (int x : q[i][1]) {
      miright[i] = min(miright[i], x);
    }
    if (miright[i] <= maleft[i]) {
      imp();
    }
  }
  int val = dfs(0, n - 1, n);
  assert(val == n - 1);
  print(0);
  puts("");
  return 0;
};