#include <bits/stdc++.h>
using namespace std;
long long n, q;
struct interv {
  long long l, r, ubonus, lbonus;
  interv(long long L, long long R, long long UBONUS, long long LBONUS) {
    l = L;
    r = R;
    ubonus = UBONUS;
    lbonus = LBONUS;
  }
  bool operator<(const interv& x) const { return r < x.r; }
};
set<interv> s;
set<interv>::iterator it;
long long x, y, to;
char dir[3];
int main() {
  scanf("%lld %lld", &n, &q);
  s.insert(interv(1, n, 0, 0));
  for (int i = 1; i <= q; i++) {
    scanf("%lld %lld", &x, &y);
    scanf("%s", dir);
    it = s.lower_bound(interv(0, x, 0, 0));
    if (it == s.end()) {
      printf("0\n");
      continue;
    }
    long long b = (*it).r;
    long long a = (*it).l;
    long long ubonus = (*it).ubonus;
    long long lbonus = (*it).lbonus;
    if (x < a) {
      printf("0\n");
      continue;
    }
    if (dir[0] == 'U') {
      printf("%lld\n", (b - a + 1) - (x - a) + ubonus);
      s.erase(it);
      if (x - 1 >= 1)
        s.insert(interv(a, x - 1, (b - a + 1) - (x - a) + ubonus, lbonus));
      if (x + 1 <= n) s.insert(interv(x + 1, b, ubonus, 0));
    } else {
      printf("%lld\n", (b - a + 1) - (b - x) + lbonus);
      s.erase(it);
      if (x - 1 >= 1) s.insert(interv(a, x - 1, 0, lbonus));
      if (x + 1 <= n)
        s.insert(interv(x + 1, b, ubonus, (b - a + 1) - (b - x) + lbonus));
    }
  }
  return 0;
}
