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 long double eps = 1e-9;
const int inf = (1 << 30) - 1;
const long long inf64 = ((long long)1 << 62) - 1;
const long double pi = acos(-1);
template <class T>
T sqr(T x) {
  return x * x;
}
template <class T>
T abs(T x) {
  return x < 0 ? -x : x;
}
const int MAXN = 1200 * 1000;
char str[10];
int tree_max[4 * MAXN];
void build_max(int v, int left, int right, int arr[]) {
  if (left == right)
    tree_max[v] = arr[left];
  else {
    int med = (left + right) / 2;
    build_max(2 * v, left, med, arr);
    build_max(2 * v + 1, med + 1, right, arr);
    tree_max[v] = max(tree_max[2 * v], tree_max[2 * v + 1]);
  }
}
int max_tree(int v, int t_left, int t_right, int left, int right) {
  if (left > right) {
    return -inf;
  }
  if (left == t_left && right == t_right) {
    return tree_max[v];
  }
  int t_med = (t_left + t_right) / 2;
  return max(
      max_tree(2 * v, t_left, t_med, left, min(right, t_med)),
      max_tree(2 * v + 1, t_med + 1, t_right, max(left, t_med + 1), right));
}
void update_max(int v, int t_left, int t_right, int pos, int new_val) {
  if (t_left == t_right) {
    tree_max[v] = new_val;
  } else {
    int t_med = (t_left + t_right) / 2;
    if (pos > t_med) {
      update_max(2 * v + 1, t_med + 1, t_right, pos, new_val);
    } else {
      update_max(2 * v, t_left, t_med, pos, new_val);
    }
    tree_max[v] = max(tree_max[2 * v], tree_max[2 * v + 1]);
  }
}
int n;
int max_l[MAXN], min_r[MAXN], max_run[MAXN];
vector<int> ans;
void go(int llerew, int rdeedf) {
  if (llerew > rdeedf) {
    return;
  }
  if (llerew == rdeedf) {
    ans.push_back(llerew);
    return;
  }
  int m = (max_l[llerew] == llerew
               ? llerew
               : max_tree(1, 0, n - 1, llerew + 1, max_l[llerew]));
  if (m >= min_r[llerew]) {
    printf("IMPOSSIBLE\n");
    exit(0);
  }
  go(llerew + 1, m);
  ans.push_back(llerew);
  go(m + 1, rdeedf);
}
int main() {
  int c;
  scanf("%d%d", &n, &c);
  for (int i = 0; i < n; ++i) {
    max_l[i] = i;
    min_r[i] = n;
    max_run[i] = i;
  }
  int a, b;
  for (int i = 0; i < c; ++i) {
    scanf("%d%d %s", &a, &b, str);
    a--, b--;
    if (b <= a) {
      printf("IMPOSSIBLE\n");
      return 0;
    }
    if (str[0] == 'L') {
      max_l[a] = max(max_l[a], b);
    } else {
      min_r[a] = min(min_r[a], b);
    }
    max_run[a] = max(max_run[a], b);
  }
  build_max(1, 0, n - 1, max_run);
  for (int i = n - 1; i >= 0; --i) {
    max_run[i] = max_tree(1, 0, n - 1, i, max_run[i]);
    update_max(1, 0, n - 1, i, max_run[i]);
  }
  go(0, n - 1);
  for (int i = 0; i < n; ++i) {
    printf("%d ", ans[i] + 1);
  }
  printf("\n");
  return 0;
}