void main(){ import std.stdio, std.string, std.conv, std.algorithm; int n, k, q; rd(n, k, q); auto a=new char[](q), b=new int[](q), c=new int[](q); foreach(i; 0..q){ rd(a[i], b[i], c[i]); b[i]--; c[i]--; } auto cnt=new long[](k); auto used=new bool[][](2, n); auto num=new long[](2); foreach_reverse(i; 0..q){ auto j=(a[i]=='R'?0:1); if(used[j][b[i]]) continue; used[j][b[i]]=true; cnt[c[i]]+=(n-num[j^1]); num[j]++; } cnt[0]=to!long(n)*n-reduce!"a+b"(cnt[1..$]); writefln("%(%s\n%)", cnt); } void rd(T...)(ref T x){ import std.stdio, std.string, std.conv; auto l=readln.split; assert(l.length==x.length); foreach(i, ref e; x){ e=l[i].to!(typeof(e)); } } void wr(T...)(T x){ import std.stdio; foreach(e; x) stderr.write(e, " "); stderr.writeln; }