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 MN = 1000111;
int n, m, maxLeft[MN], minRight[MN], a[MN], b[MN], lg[MN], maxChild[MN];
int ke[2][MN];
bool can;
int nn[22][MN], ln[22][MN];
void init() {
  for (int i = 1, t = 0; i < MN; i *= 2, ++t) lg[i] = t;
  for (int i = (2), _b = (MN - 1); i <= _b; i++)
    if (!lg[i]) lg[i] = lg[i - 1];
  for (int i = (1), _b = (n); i <= _b; i++) {
    nn[0][i] = a[i];
    ln[0][i] = b[i];
  }
  for (int t = (1), _b = (20); t <= _b; t++) {
    for (int i = (1), _b = (n - (1 << t) + 1); i <= _b; i++) {
      nn[t][i] = min(nn[t - 1][i], nn[t - 1][i + (1 << (t - 1))]);
      ln[t][i] = max(ln[t - 1][i], ln[t - 1][i + (1 << (t - 1))]);
    }
  }
}
int getMin(int l, int r) {
  if (l > r) return n + 1;
  int g = lg[r - l + 1];
  return min(nn[g][l], nn[g][r - (1 << g) + 1]);
}
int getMax(int l, int r) {
  if (l > r) return -1;
  int g = lg[r - l + 1];
  return max(ln[g][l], ln[g][r - (1 << g) + 1]);
}
void solve(int i, int l, int r) {
  if (l > r) return;
  if (getMin(l, r) < l || getMax(l, r) > r) {
    can = false;
    return;
  }
  if (maxLeft[i] == -1) {
    ke[0][i] = 0;
    ke[1][i] = l;
    solve(i + 1, i + 2, r);
  } else if (minRight[i] == n + 1) {
    ke[0][i] = l;
    ke[1][i] = 0;
    solve(i + 1, i + 2, r);
  } else {
    if (maxLeft[i] >= minRight[i]) {
      can = false;
      return;
    }
    int res = -1;
    int left = maxLeft[i], right = minRight[i] - 1;
    left = right = maxChild[maxLeft[i]];
    for (int mid = (left), _b = (min(minRight[i] - 1, right + n)); mid <= _b;
         mid++) {
      if (getMax(l, mid) <= mid && getMin(mid + 1, r) >= mid + 1) {
        res = mid;
      }
    }
    if (res == -1) {
      can = false;
      return;
    }
    ke[0][i] = i + 1;
    ke[1][i] = res + 1;
    solve(i + 1, i + 2, res);
    solve(res + 1, res + 2, r);
  }
}
void dfs(int u) {
  if (ke[0][u]) dfs(ke[0][u]);
  cout << u << ' ';
  if (ke[1][u]) dfs(ke[1][u]);
}
int it[MN * 8];
int it_get(int i, int l, int r, int u, int v) {
  if (v < l || r < u) return 0;
  if (u <= l && r <= v) return it[i];
  int mid = (l + r) >> 1;
  return max(it_get(((i) << 1), l, mid, u, v),
             it_get((((i) << 1) + 1), mid + 1, r, u, v));
}
void it_update(int i, int l, int r, int u, int val) {
  if (u < l || r < u) return;
  if (l == r) {
    it[i] = max(it[i], val);
    return;
  }
  int mid = (l + r) >> 1;
  it_update(((i) << 1), l, mid, u, val);
  it_update((((i) << 1) + 1), mid + 1, r, u, val);
  it[i] = max(it[((i) << 1)], it[(((i) << 1) + 1)]);
}
int main() {
  ios ::sync_with_stdio(false);
  cout << (fixed) << setprecision(9);
  while (cin >> n >> m) {
    memset(ke, 0, sizeof ke);
    for (int i = (1), _b = (n); i <= _b; i++) {
      maxLeft[i] = -1;
      minRight[i] = n + 1;
      maxChild[i] = i;
      a[i] = b[i] = i;
    }
    can = true;
    for (int i = (1), _b = (m); i <= _b; i++) {
      int u, v;
      string s;
      cin >> u >> v >> s;
      if (u >= v) can = false;
      if (s[0] == 'L') {
        maxLeft[u] = max(maxLeft[u], v);
      } else {
        minRight[u] = min(minRight[u], v);
      }
      a[u] = min(a[u], v);
      b[u] = max(b[u], v);
      maxChild[u] = max(maxChild[u], v);
    }
    memset(it, 0, sizeof it);
    for (int i = (n), _b = (1); i >= _b; i--) {
      int u = maxChild[i];
      it_update(1, 1, n, i, maxChild[i]);
      maxChild[i] = max(maxChild[u], it_get(1, 1, n, i, u));
      it_update(1, 1, n, i, maxChild[i]);
    }
    if (can) init();
    if (can) solve(1, 2, n);
    if (!can) {
      cout << "IMPOSSIBLE" << endl;
      continue;
    }
    dfs(1);
    cout << endl;
  }
  return 0;
}