#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using pii = pair<LL, LL>;
const LL INF = 9223372036854775807LL;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, q;
  cin >> n >> q;
  map<int, pii> fields;
  fields[0] = make_pair(0, n);
  fields[n] = make_pair(-1, -1);
  map<int, bool> seen;
  for (int i = 0; i < int(q); ++i) {
    int x, y;
    string dir;
    cin >> x >> y >> dir;
    --x;
    if (seen[x]) {
      cout << "0\n";
      continue;
    }
    seen[x] = true;
    map<int, pii>::iterator it = fields.upper_bound(x);
    map<int, pii>::iterator it2 = it;
    it2--;
    pii bounds = it2->second;
    int low = it2->first;
    if ("L" == dir) {
      cout << x + 1 - bounds.first << '\n';
      fields[low] = make_pair(bounds.first, x);
      fields[x + 1] = make_pair(bounds.first, bounds.second);
    } else {
      cout << bounds.second - x << '\n';
      fields[low] = make_pair(bounds.first, bounds.second);
      fields[x + 1] = make_pair(x + 1, bounds.second);
    }
  }
  return 0;
}
