//#define _GLIBCXX_DEBUG #include #define rep(i, n) for(int i=0; i; using vs = vector; using vi = vector; using vvi = vector; template using PQ = priority_queue; template using PQG = priority_queue, greater >; const int INF = 0xccccccc; const ll LINF = 922337203685477580LL; template inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);} template inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);} template istream &operator>>(istream &is, pair &p) { return is >> p.first >> p.second;} template ostream &operator<<(ostream &os, const pair &p) { return os << p.first << ' ' << p.second;} #define N 100100 //head int n, k, q; char a[N]; int b[N], c[N]; bitset rc[2]; int cnt[2]; ll color[N]; int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> n >> k >> q; rep(i, q) { cin >> a[i] >> b[i] >> c[i]; } for(int i = q-1; i >= 0; i--) { b[i]--; c[i]--; int id = 0; if(a[i] == 'R') id = 1; if(rc[id].test(b[i])) continue; cnt[id]++; color[c[i]] += n-cnt[id^1]; rc[id].set(b[i]); } color[0] += (ll)(n-cnt[0]) * (n-cnt[1]); rep(i, k) { cout << color[i] << endl; } }