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;
int n, c, a, b;
vector<int> L[1000007];
vector<int> R[1000007];
vector<int> TL[1000007];
vector<int> TR[1000007];
int Lans[1000007];
int Rans[1000007];
int max_l[1000007];
int min_r[1000007];
int max_v[1000007];
int min_v[1000007];
string s;
void dfs(int v) {
  max_l[v] = -1000000007;
  min_r[v] = 1000000007;
  max_v[v] = min_v[v] = v;
  for (auto it : L[v]) {
    dfs(it);
    max_l[v] = max(max_l[v], max_v[it]);
    min_v[v] = min(min_v[v], min_v[it]);
  }
  for (auto it : R[v]) {
    dfs(it);
    min_r[v] = min(min_r[v], min_v[it]);
    min_v[v] = min(min_v[v], min_v[it]);
  }
}
int znajdz(int a, int b, int l, int r) {
  int Max = -1, Min = 1000000007;
  for (int i = min(a, l), j = max(b, r + 1); i <= r && j >= l + 1; ++i, --j) {
    if (i >= a) {
      for (auto it : R[i]) {
        Max = max(Max, it);
      }
      for (auto it : L[i]) {
        Max = max(Max, it);
      }
    }
    if (j <= b) {
      for (auto it : TR[j]) {
        if (it >= a) Min = min(Min, it);
      }
      for (auto it : TL[j]) {
        if (it >= a) Min = min(Min, it);
      }
    }
    if (i >= l && Max <= i) return i;
    if (j <= r + 1 && Min >= j) return j - 1;
  }
  cerr << a << " " << b << " " << l << " " << r << '\n';
  return -1;
}
bool build(int v, int a, int b) {
  max_l[v] = max(max_l[v], a);
  min_r[v] = min(min_r[v], b + 1);
  if (a == b) return 1;
  if (max_l[v] > min_r[v]) return 0;
  int k = znajdz(a + 1, b, max_l[v], min_r[v] - 1);
  if (k == -1)
    return 0;
  else {
    if (a + 1 <= k) {
      Lans[v] = a + 1;
      if (!build(a + 1, a + 1, k)) return 0;
    }
    if (k + 1 <= b) {
      Rans[v] = k + 1;
      if (!build(k + 1, k + 1, b)) return 0;
    }
    return 1;
  }
}
void read(int v) {
  if (Lans[v]) read(Lans[v]);
  cout << v << " ";
  if (Rans[v]) read(Rans[v]);
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cin >> n >> c;
  while (c--) {
    cin >> a >> b >> s;
    if (a >= b) {
      cout << "IMPOSSIBLE";
      return 0;
    }
    if (s[0] == 'R') {
      R[a].push_back(b);
      TR[b].push_back(a);
    } else {
      L[a].push_back(b);
      TL[b].push_back(a);
    }
  }
  for (int i = 1; i <= n; ++i) {
    sort((L[i]).begin(), (L[i]).end());
    L[i].erase(unique((L[i]).begin(), (L[i]).end()), L[i].end());
    sort((R[i]).begin(), (R[i]).end());
    R[i].erase(unique((R[i]).begin(), (R[i]).end()), R[i].end());
    sort((TL[i]).begin(), (TL[i]).end());
    TL[i].erase(unique((TL[i]).begin(), (TL[i]).end()), TL[i].end());
    sort((TR[i]).begin(), (TR[i]).end());
    TR[i].erase(unique((TR[i]).begin(), (TR[i]).end()), TR[i].end());
  }
  for (int i = 1; i <= n; ++i) {
    if (!min_v[i]) dfs(i);
  }
  if (!build(1, 1, n)) {
    cout << "IMPOSSIBLE";
    return 0;
  }
  read(1);
}