#include <bits/stdc++.h>
using namespace std;
bool debug = 1;
int n, m, k;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
long long ln, lk, lm;
char s[10];
vector<int> v[105][2], ans;
int cnt;
bool dfs(int x) {
  int id = ++cnt;
  if (!v[id][0].empty()) {
    sort(v[id][0].begin(), v[id][0].end());
    if (v[id][0][0] <= cnt || !dfs(v[id][0].back())) return 0;
  }
  ans.push_back(id);
  if (!v[id][1].empty()) {
    sort(v[id][1].begin(), v[id][1].end());
    if (v[id][1][0] <= cnt || !dfs(max(v[id][1].back(), x))) return 0;
  } else {
    if (cnt < x && !dfs(x)) return 0;
  }
  return 1;
}
int main() {
  int c, x, y;
  scanf("%d%d", &n, &c);
  for (int(i) = 0; (i) < (int)(c); (i)++) {
    scanf("%d%d%s", &x, &y, s);
    v[x][s[0] == 'R'].push_back(y);
  }
  if (dfs(n)) {
    for (int c : ans) printf("%d ", c);
  } else
    puts("IMPOSSIBLE");
  return 0;
}
