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>
#pragma comment(linker, "/STACK:200000000")
using namespace std;
const int INF = (int)1E9;
const long long INF64 = (long long)1E18;
const double EPS = 1E-9;
const double EPS_ANG = 1E-16;
const double PI = acos((double)0) * 2;
const int MAXN = 110;
int n, m, a[MAXN], b[MAXN], tp[MAXN];
bool read() {
  if (!(cin >> n >> m)) return false;
  for (int i = 0; i < int(m); ++i) {
    char buf[10];
    cin >> a[i] >> b[i] >> buf;
    --a[i], --b[i];
    tp[i] = string(buf) == "RIGHT";
  }
  return true;
}
vector<int> g[MAXN];
vector<vector<int>> comps;
bool forbidden[MAXN];
int compid[MAXN];
int ans_g[MAXN][2];
int check_exp, check_tl[MAXN], check_tr[MAXN], check_t;
void dfs_comp(int v) {
  compid[v] = (int)comps.size() - 1;
  comps.back().push_back(v);
  if (forbidden[v]) return;
  for (int i = 0; i < int(g[v].size()); ++i) {
    int to = g[v][i];
    if (compid[to] == -1) dfs_comp(to);
  }
}
bool rec(vector<int> vs) {
  if (vs.size() == 1) return true;
  sort(vs.begin(), vs.end());
  int root = vs[0];
  vs.erase(vs.begin());
  forbidden[root] = true;
  set<int> child[2];
  for (int i = 0; i < int(m); ++i)
    if (a[i] == root) {
      if (!binary_search(vs.begin(), vs.end(), b[i])) return false;
      child[tp[i]].insert(b[i]);
    }
  memset(compid, -1, sizeof compid);
  comps.clear();
  for (int i = 0; i < int(n); ++i)
    if (compid[i] == -1) {
      comps.push_back(vector<int>());
      dfs_comp(i);
    }
  bool changed;
  do {
    changed = false;
    for (int tp = 0; tp < int(2); ++tp) {
      for (set<int>::iterator it = child[tp].begin(); it != child[tp].end();
           ++it) {
        int c = compid[*it];
        for (int i = 0; i < int(comps[c].size()); ++i) {
          int cand = comps[c][i];
          if (!binary_search(vs.begin(), vs.end(), cand) ||
              child[1 - tp].count(cand))
            return false;
          if (!child[tp].count(cand)) {
            child[tp].insert(cand);
            changed = true;
          }
        }
      }
      if (child[tp].size()) {
        int mi = *child[tp].begin();
        int ma = *child[tp].rbegin();
        for (int i = 0; i < int(vs.size()); ++i) {
          int cand = vs[i];
          if (mi <= cand && cand <= ma || (tp == 0 && cand <= ma) ||
              (tp == 1 && cand >= mi)) {
            if (child[1 - tp].count(cand)) return false;
            if (!child[tp].count(cand)) {
              child[tp].insert(cand);
              changed = true;
            }
          }
        }
      }
    }
  } while (changed);
  for (int i = 0; i < int(vs.size()); ++i) {
    int cand = vs[i];
    if (!child[0].count(cand) && !child[1].count(cand)) {
      child[1].insert(cand);
    }
  }
  if (child[0].size() + child[1].size() != vs.size()) throw;
  for (int tp = 0; tp < int(2); ++tp)
    if (child[tp].size()) {
      ans_g[root][tp] = *child[tp].begin();
      if (!rec(vector<int>(child[tp].begin(), child[tp].end()))) return false;
    }
  return true;
}
bool dfs_check(int v) {
  if (v != check_exp) return false;
  ++check_exp;
  if (ans_g[v][0] != -1)
    if (!dfs_check(ans_g[v][0])) return false;
  if (ans_g[v][1] != -1)
    if (!dfs_check(ans_g[v][1])) return false;
  return true;
}
void dfs_check2(int v) {
  check_tl[v] = check_t++;
  for (int tp = 0; tp < int(2); ++tp)
    if (ans_g[v][tp] != -1) dfs_check2(ans_g[v][tp]);
  check_tr[v] = check_t++;
}
bool check2() {
  dfs_check2(0);
  for (int i = 0; i < int(m); ++i) {
    int son = ans_g[a[i]][tp[i]];
    if (son == -1) return false;
    if (!(check_tl[son] <= check_tl[b[i]] && check_tr[b[i]] <= check_tr[son]))
      return false;
  }
  return true;
}
void dfs_ans(int v) {
  if (ans_g[v][0] != -1) dfs_ans(ans_g[v][0]);
  printf("%d ", v + 1);
  if (ans_g[v][1] != -1) dfs_ans(ans_g[v][1]);
}
void solve() {
  for (int i = 0; i < int(n); ++i) g[i].clear();
  for (int i = 0; i < int(m); ++i) {
    g[a[i]].push_back(b[i]);
    g[b[i]].push_back(a[i]);
  }
  memset(forbidden, 0, sizeof forbidden);
  vector<int> vs;
  for (int i = 0; i < int(n); ++i) vs.push_back(i);
  memset(ans_g, -1, sizeof ans_g);
  check_exp = 0;
  if (!rec(vs) || !dfs_check(0) || !check2()) {
    puts("IMPOSSIBLE");
    return;
  }
  dfs_ans(0);
  puts("");
}
int main() {
  if (!read()) throw;
  solve();
}