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 = 1e6 + 100;
vector<pair<int, int> > v[MN];
vector<int> ans;
int v2[MN][2];
int nodeGroup[MN];
int find(int a) {
  if (nodeGroup[a] == a) return a;
  return nodeGroup[a] = find(nodeGroup[a]);
}
void merge(int a, int b) { nodeGroup[find(a)] = nodeGroup[find(b)]; }
int used[MN];
int used2[MN];
int id = 1;
int lol = 0;
void f(int x, int ma) {
  used[x] = 1;
  int leftMax = 0;
  int rightMax = 0;
  for (auto y : v[x]) {
    if (y.second == 0) leftMax = max(leftMax, y.first);
    if (y.second == 1) rightMax = max(rightMax, y.first);
  }
  v2[x][0] = -1;
  v2[x][1] = -1;
  if (id < leftMax) {
    v2[x][0] = ++id;
    f(id, leftMax);
  }
  ans.push_back(x);
  ma = max(rightMax, ma);
  int rmi = id + 1;
  if (id < ma) {
    v2[x][1] = ++id;
    f(id, ma);
  }
  int rma = id;
  int lmi = x + 1;
  int lma = 1;
  if (v2[x][1] != -1) {
    lma = v2[x][1] - 1;
  } else
    lma = id;
  for (auto y : v[x]) {
    if (y.second == 0) {
      if (!(y.first >= lmi && y.first <= lma)) lol = 1;
    } else {
      if (!(y.first >= rmi && y.first <= rma)) lol = 1;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, c;
  cin >> n >> c;
  for (int i = 0; i < c; ++i) {
    int q, w;
    string s;
    cin >> q >> w >> s;
    if (s == "LEFT") {
      v[q].push_back({w, 0});
    } else {
      v[q].push_back({w, 1});
    }
  }
  for (int i = 1; i <= n; ++i) {
    nodeGroup[i] = i;
  }
  id = 0;
  for (; id < n;) {
    int x = ++id;
    if (used[x]) continue;
    used[x] = 1;
    int leftMax = 0;
    int rightMax = 0;
    for (auto y : v[x]) {
      if (y.second == 0) leftMax = max(leftMax, y.first);
      if (y.second == 1) rightMax = max(rightMax, y.first);
    }
    v2[x][0] = -1;
    v2[x][1] = -1;
    if (id < leftMax) {
      v2[x][0] = ++id;
      f(id, leftMax);
    }
    ans.push_back(x);
    int rmi = id + 1;
    if (id < rightMax) {
      v2[x][1] = ++id;
      f(id, rightMax);
    }
    int rma = id;
    int lmi = 2;
    int lma = 1;
    if (v2[x][1] != -1) {
      lma = v2[x][1] - 1;
    } else
      lma = id;
    for (auto y : v[x]) {
      if (y.second == 0) {
        if (!(y.first >= lmi && y.first <= lma)) lol = 1;
      } else {
        if (!(y.first >= rmi && y.first <= rma)) lol = 1;
      }
    }
  }
  if (id != n || lol) {
    cout << "IMPOSSIBLE\n";
    return 0;
  }
  for (auto x : ans) {
    cout << x << ' ';
  }
  cout << '\n';
}