func_code_string: #include <bits/stdc++.h>   using namespace std;   template <typename T>   T gcd(T x, T y) {     while (y > 0) {       x %= y;       swap(x, y);     }     return x;   }   template <class _T>   inline _T sqr(const _T& x) {     return x * x;   }   template <class _T>   inline string tostr(const _T& a) {     ostringstream os(  );     os << a;     return os.str();   }   const long double PI = 3.1415926535897932384626433832795L;   template <typename T>   inline void input(T& a) {     static int c;     a = 0;     while (!isdigit(c = getchar()) && c !=  - ) {     }     char neg = 0;     if (c ==  - ) {       neg = 1;       c = getchar();     }     while (isdigit(c)) {       a = 10 * a + c -  0 ;       c = getchar();     }     if (neg) a = -a;   }   template <typename T = int>   inline T nxt() {     T res;     input(res);     return res;   }   void solve() {}   void imp() {     puts( IMPOSSIBLE );     exit(0);   }   const int N = 1000010;   vector<int> q[N][2];   int g[N][2];   int r[N];   int maleft[N];   int miright[N];   int n;   int dfs(int v, int le, int ri) {     if (r[v] >= ri) {       imp();     }     if (v >= ri) {       imp();     }     if (le >= ri) {       imp();     }     if (maleft[v] > v) {       g[v][0] = v + 1;       int ret = dfs(v + 1, maleft[v], min(ri, miright[v]));       le = max(le, r[v]);       if (ret < le) {         g[v][1] = ret + 1;         return dfs(ret + 1, le, ri);       } else {         return ret;       }     } else {       le = max(le, r[v]);       if (v < le) {         g[v][1] = v + 1;         return dfs(v + 1, le, ri);       }     }     return v;   }   void print(int v) {     if (v >= n) {       return;     }     if (g[v][0]) {       print(g[v][0]);     }     printf( %d  , v + 1);     if (g[v][1]) {       print(g[v][1]);     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     int c;     n = nxt();     c = nxt();     char s[10];     for (int i = 0; i < c; ++i) {       int a = nxt() - 1;       int b = nxt() - 1;       if (b <= a) {         imp();       }       scanf( %s , s);       if (s[0] ==  L ) {         q[a][0].push_back(b);       } else {         q[a][1].push_back(b);       }     }     for (int i = 0; i < n; ++i) {       r[i] = i;       maleft[i] = i;       miright[i] = INT_MAX;     }     for (int i = n - 2; i >= 0; --i) {       for (int x : q[i][0]) {         r[i] = max(r[i], r[x]);       }       for (int x : q[i][1]) {         r[i] = max(r[i], r[x]);       }       for (int x : q[i][0]) {         maleft[i] = max(maleft[i], r[x]);       }       for (int x : q[i][1]) {         miright[i] = min(miright[i], x);       }       if (miright[i] <= maleft[i]) {         imp();       }     }     int val = dfs(0, n - 1, n);     assert(val == n - 1);     print(0);     puts(  );     return 0;   };   