#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
//using namespace atcoder;
using ll=long long;
using ld=long double;
using pll=pair<ll, ll>;
//using mint = modint1000000007;
#define rep(i,n) for (ll i=0; i<n; ++i)
#define all(c) begin(c),end(c)
#define PI acos(-1)
#define oo 2e18
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
//priority_queue<ll, vector<ll>, greater<ll>> Q;
/*
bが入ったら、aの、それ未満を上書き。　それ以上は関係ない
aが入ったら、bの未満を上書き
BIT2つかな

*/
// BIT,index = 1 ~ (0を投げるととまる）
// https://atcoder.jp/contests/abc174/submissions/21572028
//indexにする・・・？ちょうたいへん

#define M 200010
ll dat1[M], dat2[M], dat3[M], dat4[M]; //34=累積いれとく？

void add(ll i, ll x, ll id){
  if (id==1)
    for(; i<M; i += i&-i) dat1[i] += x;
  if (id==2)
    for(; i<M; i += i&-i) dat2[i] += x;
  if (id==3)
    for(; i<M; i += i&-i) dat3[i] += x;
  if (id==4)
    for(; i<M; i += i&-i) dat4[i] += x;
}

ll sum(ll i, ll id){
  ll res = 0;
  if (id==1)
    for(; i>0; i -= i&-i) res += dat1[i];
  if (id==2)
    for(; i>0; i -= i&-i) res += dat2[i];
  if (id==3)
    for(; i>0; i -= i&-i) res += dat3[i];
  if (id==4)
    for(; i>0; i -= i&-i) res += dat4[i];
  return res;
}

ll rangesum(ll L, ll R, ll id){
  return sum(R, id) - sum(L-1, id);
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(10);
  ll n, m, q;
  cin >> n >> m >> q;
  ll used[3][200010]; //t, x
  rep(i, 3) rep(j, 200010) used[i][j]=1;
  ll ans = n*m;
  add(1, n, 1); //1->0
  add(1, m, 2);
  add(1, n, 3); //1->0
  add(1, m, 4);
  //34が累積和
  ll T[200010];
  ll X[200010];
  ll Y[200010];
  map<ll, ll> mp1; // val->id
  map<ll, ll> mp2; // id->val
  set<ll> se;
  se.insert(1);
  rep(i, q){
    cin >> T[i] >> X[i] >> Y[i];
    Y[i]++;
    se.insert(Y[i]);
  }
  ll cnt = 1;
  for(auto v: se){
    mp1[v] = cnt++;
  }
  cnt=1;
  for(auto v: se){      
    mp2[cnt++]=v;
  }
  rep(i, q){
    ll t=T[i];
    ll x=X[i];
    ll y=Y[i];
    ll z=used[t][x]; //val
    //まず除く
    ll zz=mp1[z];//id
    ans -= z*sum(zz, t^3); // もとあった値をなかったことに
    ans += sum(zz, (t^3)+2); // なかった場合の復元
    add(zz, -1, t);
    add(zz, -z, t+2);//累積
    used[t][x]=y;
    ll yy=mp1[y]; //id
    ans -= sum(yy, (t^3)+2);
    ans += y*sum(yy, (t^3));
    add(yy, 1, t);
    add(yy, y, t+2);
    cout << ans -n*m<< endl;
  }
}
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
ll N,M,Q;
map<ll,ll>mp;
map<ll,ll>mp1;
P dat[2][800005];
ll n;
void init(ll n_){
  n=1;
while(n<=n_)n*=2;
  for(ll i=0;i<2*n-1;i++){
  dat[0][i]=P(0,0);
    dat[1][i]=P(0,0);
  }
}
void update(ll j,ll k,ll a){
 ll m=mp1.at(k); k+=n-1;
dat[j][k].first+=a;dat[j][k].second+=a*m;
  while(0<k){
  k=(k-1)/2;
    dat[j][k].first=(dat[j][2*k+1].first+dat[j][2*k+2].first);
    dat[j][k].second=(dat[j][2*k+1].second+dat[j][2*k+2].second);
  }

}
P query(ll j,ll a,ll b,ll k,ll l,ll r){
if(a<=l&&r<=b)return dat[j][k];
  else if(b<=l||r<=a)return P(0,0);
  else{
    
  P val=query(j,a,b,2*k+1,l,(l+r)/2);
    P var=query(j,a,b,2*k+2,(l+r)/2,r);
    P p(val.first+var.first,val.second+var.second);
    return p;
  
  }

}
int main(){
  cin>>N>>M>>Q;
  set<ll>S;S.insert(0);
  vector<ll>T(Q);vector<ll>X(Q);vector<ll>Y(Q);
  for(ll q=0;q<Q;q++){
  cin>>T[q];cin>>X[q];X[q]--;cin>>Y[q];S.insert(Y[q]);
  }ll I=0;
  for(auto x:S){mp[x]=I;I++;}
  for(auto p:mp){mp1[p.second]=p.first;}vector<ll>A(N);vector<ll>B(M);ll ans=0;
  init(I);update(0,0,N);update(1,0,M);
    for(ll q=0;q<Q;q++){
 if(T[q]==1){
 ans-=query(1,0,mp.at(A[X[q]])+1,0,0,n).first*A[X[q]];
 if(A[X[q]]<Y[q]){
 ans-=query(1,mp.at(A[X[q]])+1,mp.at(Y[q])+1,0,0,n).second;
 }else if(Y[q]<A[X[q]]){
  ans+=query(1,mp.at(Y[q])+1,mp.at(A[X[q]])+1,0,0,n).second;
 }else{}
 ans+=query(1,0,mp.at(Y[q])+1,0,0,n).first*Y[q];update(0,mp.at(A[X[q]]),-1);
             update(0,mp.at(Y[q]),1);A[X[q]]=Y[q];
 }else{
  ans-=query(0,0,mp.at(B[X[q]])+1,0,0,n).first*B[X[q]];
 if(B[X[q]]<Y[q]){
 ans-=query(0,mp.at(B[X[q]])+1,mp.at(Y[q])+1,0,0,n).second;
 }else if(Y[q]<B[X[q]]){
  ans+=query(0,mp.at(Y[q])+1,mp.at(B[X[q]])+1,0,0,n).second;
 }else{}
 ans+=query(0,0,mp.at(Y[q])+1,0,0,n).first*Y[q];update(1,mp.at(B[X[q]]),-1);
             update(1,mp.at(Y[q]),1);B[X[q]]=Y[q];
 }cout<<ans<<endl;
  }

 return 0;
}