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>
inline T sqr(T x) {
  return x * x;
}
const double EPS = 1e-9;
const int INF = 1e9;
struct SegmTreeMax {
  vector<set<int> > S;
  vector<int> t;
  int sz;
  SegmTreeMax(int n = 0) {
    sz = 1;
    while (sz < n) sz *= 2;
    t.assign(sz * 2, -INF);
    S.resize(sz);
  }
  void put(int pos, int val) {
    int v = sz + pos;
    S[pos].insert(val);
    t[v] = *S[pos].rbegin();
    v /= 2;
    while (v) {
      t[v] = max(t[v * 2], t[v * 2 + 1]);
      v /= 2;
    }
  }
  void del(int pos, int val) {
    int v = sz + pos;
    S[pos].erase(val);
    t[v] = S[pos].empty() ? -INF : *S[pos].rbegin();
    v /= 2;
    while (v) {
      t[v] = max(t[v * 2], t[v * 2 + 1]);
      v /= 2;
    }
  }
  int get_max(int l, int r) {
    int ans = -INF;
    l += sz;
    r += sz;
    while (l <= r) {
      ans = max(ans, t[l]);
      ans = max(ans, t[r]);
      l = (l + 1) / 2;
      r = (r - 1) / 2;
    }
    return ans;
  }
};
struct SegmTreeMin {
  vector<set<int> > S;
  vector<int> t;
  int sz;
  SegmTreeMin(int n = 0) {
    sz = 1;
    while (sz < n) sz *= 2;
    t.assign(sz * 2, INF);
    S.resize(sz);
  }
  void put(int pos, int val) {
    int v = sz + pos;
    S[pos].insert(val);
    t[v] = *S[pos].begin();
    v /= 2;
    while (v) {
      t[v] = min(t[v * 2], t[v * 2 + 1]);
      v /= 2;
    }
  }
  void del(int pos, int val) {
    int v = sz + pos;
    S[pos].erase(val);
    t[v] = S[pos].empty() ? INF : *S[pos].begin();
    v /= 2;
    while (v) {
      t[v] = min(t[v * 2], t[v * 2 + 1]);
      v /= 2;
    }
  }
  int get_min(int l, int r) {
    int ans = INF;
    l += sz;
    r += sz;
    while (l <= r) {
      ans = min(ans, t[l]);
      ans = min(ans, t[r]);
      l = (l + 1) / 2;
      r = (r - 1) / 2;
    }
    return ans;
  }
};
const int MAXN = 2e6 + 10;
SegmTreeMax T_max;
SegmTreeMin T_min;
vector<int> sdhfsjkshdjkfsdfgkqqweqweh[MAXN];
vector<int> yytrwtretywretwreytwreytwr[MAXN];
int n, c;
int L[MAXN];
int R[MAXN];
void go(int l, int r) {
  if (l == r) {
    return;
  }
  int max_left = -INF;
  for (int b : sdhfsjkshdjkfsdfgkqqweqweh[l]) {
    max_left = max(max_left, b);
    T_max.del(b, l);
    T_min.del(b, l);
  }
  int min_right = INF;
  for (int b : yytrwtretywretwreytwreytwr[l]) {
    min_right = min(min_right, b);
    T_max.del(b, l);
    T_min.del(b, l);
  }
  if (sdhfsjkshdjkfsdfgkqqweqweh[l].empty()) {
    R[l] = l + 1;
    go(l + 1, r);
    return;
  }
  if (yytrwtretywretwreytwreytwr[l].empty()) {
    L[l] = l + 1;
    go(l + 1, r);
    return;
  }
  while (1) {
    int nmax_left = T_max.get_max(l + 1, max_left);
    if (nmax_left <= max_left) {
      break;
    }
    max_left = nmax_left;
  }
  while (1) {
    int nmin_right = T_min.get_min(min_right, r);
    if (nmin_right >= min_right) {
      break;
    }
    min_right = nmin_right;
  }
  if (max_left >= min_right) {
    puts("IMPOSSIBLE");
    exit(0);
  }
  if (min_right == l + 1) {
    R[l] = l + 1;
    go(l + 1, r);
    return;
  }
  if (max_left == r) {
    L[l] = l + 1;
    go(l + 1, r);
    return;
  }
  L[l] = l + 1;
  R[l] = max_left + 1;
  go(l + 1, max_left);
  go(max_left + 1, r);
}
void dfs(int v) {
  if (v == -1) {
    return;
  }
  dfs(L[v]);
  printf("%d ", v + 1);
  dfs(R[v]);
}
int main() {
  cin >> n >> c;
  T_max = SegmTreeMax(n + 10);
  T_min = SegmTreeMin(n + 10);
  for (int i = 0; i < (int)c; ++i) {
    int a, b;
    char buf[10];
    scanf("%d %d %s\n", &a, &b, buf);
    --a;
    --b;
    if (b <= a) {
      puts("IMPOSSIBLE");
      return 0;
    }
    if (buf[0] == 'L') {
      sdhfsjkshdjkfsdfgkqqweqweh[a].push_back(b);
    } else {
      yytrwtretywretwreytwreytwr[a].push_back(b);
    }
    T_max.put(a, b);
    T_min.put(a, b);
    T_max.put(b, a);
    T_min.put(b, a);
  }
  memset(L, -1, sizeof L);
  memset(R, -1, sizeof R);
  go(0, n - 1);
  dfs(0);
  return 0;
}