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;
string S;
const int N = 1e6 + 5, INF = 1e7;
vector<pair<int, int> > tree;
vector<pair<int, int> > cons[N];
int maxLeft[N], maxRight[N], minLeft[N], minRight[N];
int vals[N];
bool okay;
int pre[N];
int segTree[N * 4];
int query(int cur, int cL, int cR, int l, int r) {
  if (cL > r || cR < l) {
    return 0;
  }
  if (cL >= l && cR <= r) {
    return segTree[cur];
  }
  int mid = (cL + cR) / 2;
  return max(query(cur * 2, cL, mid, l, r),
             query(cur * 2 + 1, mid + 1, cR, l, r));
}
void update(int cur, int cL, int cR, int p, int val) {
  if (p == cL && p == cR) {
    segTree[cur] = val;
    return;
  }
  if (cL > p || cR < p) {
    return;
  }
  int mid = (cL + cR) / 2;
  update(cur * 2, cL, mid, p, val);
  update(cur * 2 + 1, mid + 1, cR, p, val);
  segTree[cur] = max(segTree[cur * 2], segTree[cur * 2 + 1]);
}
void init() {
  pre[n] = n;
  for (int i = n - 1; i >= 1; i--) {
    int q = query(1, 1, n, i, maxLeft[i]);
    pre[i] = q;
    q = query(1, 1, n, i, max(maxRight[i], maxLeft[i]));
    update(1, 1, n, i, q);
  }
}
int solve(int s, int e) {
  if (s > e) {
    return -1;
  }
  int myIdx = tree.size();
  tree.push_back(pair<int, int>(-1, -1));
  vals[myIdx] = s;
  if (s == e) {
    okay &= cons[s].size() == 0;
    return myIdx;
  }
  int lastLeft = pre[s];
  if (minLeft[s] < s) {
    okay = false;
    return myIdx;
  }
  if (maxLeft[s] > e) {
    okay = false;
    return myIdx;
  }
  int startRight = lastLeft + 1;
  if (minRight[s] < startRight) {
    okay = false;
    return myIdx;
  }
  if (maxRight[s] > e) {
    okay = false;
    return myIdx;
  }
  int left = solve(s + 1, lastLeft);
  int right = solve(startRight, e);
  tree[myIdx].first = left;
  tree[myIdx].second = right;
  return myIdx;
}
void inorder(int cur) {
  if (cur == -1) return;
  inorder(tree[cur].first);
  cout << vals[cur] << " ";
  inorder(tree[cur].second);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  tree.push_back(pair<int, int>(-1, -1));
  cin >> n >> c;
  int a, b;
  for (int i = 1; i < N; i++) {
    minLeft[i] = minRight[i] = INF;
    maxLeft[i] = maxRight[i] = i;
    update(1, 1, n, i, i);
  }
  for (int i = 0; i < c; i++) {
    cin >> a >> b >> S;
    cons[a].push_back(pair<int, int>(b, S == "RIGHT"));
    if (S == "RIGHT") {
      maxRight[a] = max(maxRight[a], b);
      minRight[a] = min(minRight[a], b);
    } else {
      maxLeft[a] = max(maxLeft[a], b);
      minLeft[a] = min(minLeft[a], b);
    }
  }
  okay = true;
  init();
  solve(1, n);
  if (!okay) {
    cout << "IMPOSSIBLE" << endl;
  } else {
    inorder(1);
  }
  return 0;
}