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;
void reader(int *x) {
  int k, m = 0;
  *x = 0;
  for (;;) {
    (k) = getchar();
    if (k == '-') {
      m = 1;
      break;
    }
    if ('0' <= k && k <= '9') {
      *x = k - '0';
      break;
    }
  }
  for (;;) {
    (k) = getchar();
    if (k < '0' || k > '9') break;
    *x = (*x) * 10 + k - '0';
  }
  if (m) (*x) = -(*x);
}
void reader(long long *x) {
  int k, m = 0;
  *x = 0;
  for (;;) {
    (k) = getchar();
    if (k == '-') {
      m = 1;
      break;
    }
    if ('0' <= k && k <= '9') {
      *x = k - '0';
      break;
    }
  }
  for (;;) {
    (k) = getchar();
    if (k < '0' || k > '9') break;
    *x = (*x) * 10 + k - '0';
  }
  if (m) (*x) = -(*x);
}
void reader(double *x) { scanf("%lf", x); }
int reader(char c[]) {
  int i, s = 0;
  for (;;) {
    (i) = getchar();
    if (i != ' ' && i != '\n' && i != '\r' && i != '\t' && i != EOF) break;
  }
  c[s++] = i;
  for (;;) {
    (i) = getchar();
    if (i == ' ' || i == '\n' || i == '\r' || i == '\t' || i == EOF) break;
    c[s++] = i;
  }
  c[s] = '\0';
  return s;
}
template <class T, class S>
void reader(T *x, S *y) {
  reader(x);
  reader(y);
}
template <class T, class S, class U>
void reader(T *x, S *y, U *z) {
  reader(x);
  reader(y);
  reader(z);
}
template <class T, class S, class U, class V>
void reader(T *x, S *y, U *z, V *w) {
  reader(x);
  reader(y);
  reader(z);
  reader(w);
}
void writer(int x, char c) {
  int s = 0, m = 0;
  char f[10];
  if (x < 0) m = 1, x = -x;
  while (x) f[s++] = x % 10, x /= 10;
  if (!s) f[s++] = 0;
  if (m) putchar('-');
  while (s--) putchar(f[s] + '0');
  putchar(c);
}
void writer(long long x, char c) {
  int s = 0, m = 0;
  char f[20];
  if (x < 0) m = 1, x = -x;
  while (x) f[s++] = x % 10, x /= 10;
  if (!s) f[s++] = 0;
  if (m) putchar('-');
  while (s--) putchar(f[s] + '0');
  putchar(c);
}
void writer(double x, char c) {
  printf("%.15f", x);
  putchar(c);
}
void writer(const char c[]) {
  int i;
  for (i = 0; c[i] != '\0'; i++) putchar(c[i]);
}
void writer(const char x[], char c) {
  int i;
  for (i = 0; x[i] != '\0'; i++) putchar(x[i]);
  putchar(c);
}
template <class T>
void writerLn(T x) {
  writer(x, '\n');
}
template <class T, class S>
void writerLn(T x, S y) {
  writer(x, ' ');
  writer(y, '\n');
}
template <class T, class S, class U>
void writerLn(T x, S y, U z) {
  writer(x, ' ');
  writer(y, ' ');
  writer(z, '\n');
}
template <class T>
void writerArr(T x[], int n) {
  int i;
  if (!n) {
    putchar('\n');
    return;
  }
  for (i = 0; i < n - 1; i++) writer(x[i], ' ');
  writer(x[n - 1], '\n');
}
template <class T>
struct segtreeMinVal {
  int size, mem;
  T *val, *minVal;
  void malloc(int N) {
    mem = N;
    val = (T *)std::malloc(sizeof(T) * N);
    minVal = (T *)std::malloc(sizeof(T) * N * 4);
  }
  void free(void) {
    mem = 0;
    std::free(val);
    std::free(minVal);
  }
  void init_sub(int node, int left, int right) {
    int sz = right - left, n1 = node * 2 + 1, n2 = node * 2 + 2;
    if (sz == 1)
      minVal[node] = val[left];
    else {
      init_sub(n1, left, left + sz / 2);
      init_sub(n2, left + sz / 2, right);
      minVal[node] = min(minVal[n1], minVal[n2]);
    }
  }
  void init(int N, int zerofill = 0) {
    int i;
    size = N;
    if (zerofill)
      for (i = 0; i < N; i++) val[i] = 0;
    init_sub(0, 0, N);
  }
  void change_sub(int node, int left, int right, int n) {
    int sz = right - left, n1 = node * 2 + 1, n2 = node * 2 + 2;
    if (n < left || n >= right) return;
    if (sz == 1)
      minVal[node] = val[left];
    else {
      change_sub(n1, left, left + sz / 2, n);
      change_sub(n2, left + sz / 2, right, n);
      minVal[node] = min(minVal[n1], minVal[n2]);
    }
  }
  void change(int n, T v) {
    if (val[n] == v) return;
    val[n] = v;
    change_sub(0, 0, size, n);
  }
  T get_minVal_sub(int node, int left, int right, int a, int b) {
    int sz = right - left, n1 = node * 2 + 1, n2 = node * 2 + 2;
    if (a < left) a = left;
    if (b > right) b = right;
    if (a >= b) return numeric_limits<T>::max();
    if (a == left && b == right) return minVal[node];
    return min(get_minVal_sub(n1, left, left + sz / 2, a, b),
               get_minVal_sub(n2, left + sz / 2, right, a, b));
  }
  T get_minVal(int a, int b) { return get_minVal_sub(0, 0, size, a, b); }
};
char memarr[17000000];
void *mem = memarr;
int N, C;
vector<pair<int, int> > edge[1100000];
int mx[1100000];
int lef[1100000], rig[1100000];
int res[1100000], ress;
segtreeMinVal<int> t;
int solve(int st, int ed) {
  int i, j, k, m;
  if (st == ed) {
    if (edge[st].size()) return 0;
    lef[st] = rig[st] = -1;
    return 1;
  }
  if (edge[st].size() == 0) {
    lef[st] = -1;
    rig[st] = st + 1;
    return solve(st + 1, ed);
  }
  if (edge[st][0].second == 1) {
    lef[st] = -1;
    rig[st] = st + 1;
    return solve(st + 1, ed);
  }
  if (edge[st][edge[st].size() - 1].second == -1) {
    lef[st] = st + 1;
    rig[st] = -1;
    return solve(st + 1, ed);
  }
  m = -1;
  for (i = 0; i < edge[st].size(); i++) {
    if (edge[st][i].second == 1) {
      m = -t.get_minVal(st + 1, edge[st][i - 1].first + 1);
      if (m >= edge[st][i].first || m >= ed) return 0;
      if (!solve(st + 1, m)) return 0;
      if (!solve(m + 1, ed)) return 0;
      lef[st] = st + 1;
      rig[st] = m + 1;
      return 1;
    }
  }
  assert(0);
  return 0;
}
void print(int st) {
  if (lef[st] >= 0) print(lef[st]);
  res[ress++] = st + 1;
  if (rig[st] >= 0) print(rig[st]);
}
int main() {
  int i, j, k;
  int A, B;
  char buf[100];
  int x, y;
  int dame = 0;
  reader(&N, &C);
  for (i = 0; i < C; i++) {
    reader(&A, &B, buf);
    A--;
    B--;
    if (A >= B) dame = 1;
    edge[A].push_back(make_pair(B, buf[0] == 'L' ? -1 : 1));
  }
  for (i = 0; i < N; i++) {
    sort(edge[i].begin(), edge[i].end());
    for (j = 1; j < edge[i].size(); j++)
      if (edge[i][j].second < edge[i][j - 1].second) dame = 1;
  }
  if (dame) {
    writerLn("IMPOSSIBLE");
    return 0;
  }
  t.malloc(N + 1);
  t.init(N + 1, 1);
  for (i = N - 1; i >= 0; i--) {
    if (edge[i].size() == 0) {
      mx[i] = i;
    } else {
      mx[i] = edge[i][edge[i].size() - 1].first;
      mx[i] = max(mx[i], -t.get_minVal(i + 1, mx[i] + 1));
    }
    t.change(i, -mx[i]);
  }
  if (!solve(0, N - 1)) dame = 1;
  if (dame) {
    writerLn("IMPOSSIBLE");
    return 0;
  }
  print(0);
  writerArr(res, ress);
  return 0;
}