void main(){ import std.stdio, std.string, std.conv, std.algorithm; long n; int 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]=n*n-reduce!((r, e)=>(r+e))(0L, 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; }