#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
//Mystery_Sky
//
#define ll long long
#define maxn 10000010
#define M 1000005
#define Mid (l+r)>>1
struct Tree{
    Tree *lc, *rc;
    ll L, R, E;
    bool p;
}dizhi[M<<1], *root = &dizhi[0];

Tree dizhi2[M<<1], *root2 = &dizhi2[0];

int t = 1, n, m;
void pushup(Tree *tree)
{
    tree->p = tree->lc->p && tree->rc->p;
    tree->E = max(tree->lc->R + tree->rc->L, max(tree->lc->E, tree->rc->E));
    tree->L = tree->lc->p == true ? tree->lc->E + tree->rc->L : tree->lc->L;
    tree->R = tree->rc->p == true ? tree->rc->E + tree->lc->R : tree->rc->R;
}

void build(Tree *tree, int l, int r) {
    if(l == r) {
        tree->L = tree->R = tree->E = 1;
        tree->p = true;
        return;
    }
    int mid = Mid;
    tree->lc = &dizhi[t++];
    tree->rc = &dizhi[t++];
    build(tree->lc, l, mid);
    build(tree->rc, mid+1, r);
    pushup(tree);
}

void build2(Tree *tree, int l, int r) {
    if(l == r) {
        tree->L = tree->R = tree->E = 1;
        tree->p = true;
        return;
    }
    int mid = Mid;
    tree->lc = &dizhi2[t++];
    tree->rc = &dizhi2[t++];
    build2(tree->lc, l, mid);
    build2(tree->rc, mid+1, r);
    pushup(tree);
}

void Update(Tree *tree, int l, int r, int x)
{
    if(l == r) {
        tree->E = tree->L = tree->R = 0;
        tree->p = false;
        return;
    }
    int mid = Mid;
    if(x <= mid) Update(tree->lc, l, mid, x);
    else Update(tree->rc, mid+1, r, x);
    pushup(tree);
}
int w, h;
int main() {
    scanf("%d%d%d", &w, &h, &m);
    build(root, 1, w-1);
    t = 1;
    build2(root2, 1, h-1);
    int b;
    char a;
    for(int i = 1; i <= m; i++) {
        cin >> a >> b;
        if(a == 'H') {
            Update(root2, 1, h-1, b);
        }
        if(a == 'V') {
            Update(root, 1, w-1, b);
        }
        printf("%lld\n", (root->E+1) * (root2->E+1));
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
set<long long> ex;
set<long long> ey;
multiset<long long> x;
multiset<long long> y;
int main()
{
	long long w,h;
	int n;
	scanf("%lld %lld %d",&w,&h,&n);
	ex.insert(0);
	ex.insert(w);
	ey.insert(0);
	ey.insert(h);
	x.insert(w);
	y.insert(h);
	for(int i=1;i<=n;i++)
	{
		char aa;
		int bb;
		scanf("\n%c %d",&aa,&bb);
		if(aa=='H')
		{
			ey.insert(bb);
			int s=*(--ey.lower_bound(bb));
			int b=*(ey.upper_bound(bb));
			y.insert(b-bb);
			y.insert(bb-s);
			y.erase(y.find(b-s));
		}
		else
		{
			ex.insert(bb);
			int s=*(--ex.lower_bound(bb));
			int b=*(ex.upper_bound(bb));
			x.insert(b-bb);
			x.insert(bb-s);
			x.erase(x.find(b-s));
		}
		cout<<(*x.rbegin())*(*y.rbegin())<<endl;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rint register int
#define ls k<<1
#define rs k<<1|1
const int mn=2e5+100;
int rd(){
    rint x=0,f=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9'){x=(x<<3)+(x<<1)+(c^48);c=getchar();}
	return x*f;
}
struct node{
     int sum,z,y,p;
}a[mn*4][3];
int w,h,x,q;
char c;
void build(int k,int l,int r,int sz){
     if(l==r){
        a[k][sz].sum=1;
        a[k][sz].z=1;a[k][sz].y=1;
        a[k][sz].p=1;
        return;
	 }
	 int mid=l+(r-l)/2;
	 build(ls,l,mid,sz);
	 build(rs,mid+1,r,sz);
	 a[k][sz].sum=a[ls][sz].sum+a[rs][sz].sum;
	 a[k][sz].z=a[k][sz].sum;a[k][sz].y=a[k][sz].sum;
	 a[k][sz].p=1;
}
/*void pushup(int k,int l,int r,int sz){
     a[k][sz].z=a[k*2][sz].z;a[k][sz].y=a[k*2+1][sz].y;
     if(a[k*2][sz].p==1){
        a[k][sz].z+=a[k*2+1][sz].z;
	 }
	 if(a[k*2+1][sz].p==1){
	    a[k][sz].y+=a[k*2][sz].y;
	 }
	 a[k][sz].sum=max(max(a[ls][sz].sum,a[rs][sz].sum),a[ls][sz].y+a[rs][sz].z);
	 if(a[k][sz].sum==r-l+1)a[k][sz].p=1;
}*/
void pushup(int k,int lt,int rt,int sz){
     if(a[ls][sz].p==1)a[k][sz].z=a[ls][sz].z+a[rs][sz].z;
	 else a[k][sz].z=a[ls][sz].z;
	 if(a[rs][sz].p==1)a[k][sz].y=a[rs][sz].y+a[ls][sz].y;
	 else a[k][sz].y=a[rs][sz].y;
	 a[k][sz].sum=max(max(a[ls][sz].sum,a[rs][sz].sum),a[ls][sz].y+a[rs][sz].z);
	 if(a[k][sz].sum==rt-lt+1)a[k][sz].p=1;
	 else a[k][sz].p=0;
}
void xg(int k,int lt,int rt,int q,int sz){
	//printf("%d %d\n",lt,rt);
	 if(rt<q||lt>q)return ;
     if(lt==rt&&lt==q){
	   a[k][sz].sum=0;
	   a[k][sz].z=a[k][sz].sum;a[k][sz].y=a[k][sz].sum;
	   a[k][sz].p=0;
	 //  printf("%d %d %d %d\n",sz,a[k][sz].sum,a[k][sz].z,a[k][sz].zp);
	   return;
	 }
	 int mid=lt+(rt-lt)/2;
	 xg(ls,lt,mid,q,sz);xg(rs,mid+1,rt,q,sz);
	 pushup(k,lt,rt,sz);
}
signed main()
{
	w=rd();h=rd();q=rd();
	build(1,1,w-1,1);
	build(1,1,h-1,2);
	for(rint i=1;i<=q;++i){
	     scanf("\n%c%lld",&c,&x);
		 if(c=='V'){
	        xg(1,1,w-1,x,1);
	        printf("%lld\n",(a[1][1].sum+1)*(a[1][2].sum+1));
		 }else{
		    xg(1,1,h-1,x,2);
		    printf("%lld\n",(a[1][1].sum+1)*(a[1][2].sum+1));
		 }
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<map>
#include<string>
#include<vector>
#include<queue>
#define kl (k*2)
#define mid ((l+r)/2)
#define sum （r-l+1)
using namespace std;
long long n,m,x,y,q,p,h,w;
char c;
struct tree{
    int lazy,maxx,lmaxx,rmaxx,len;
    bool check;
}t[2000000][4];
void ud(int k,int l,int r,int f)
{
    if(t[kl][f].maxx==t[kl][f].len&&!t[k][f].check)
    {
        t[k][f].lmaxx=t[kl][f].len+t[kl+1][f].lmaxx;
    }
    else
    {
        t[k][f].lmaxx=t[kl][f].lmaxx;
    }
    if(t[kl+1][f].len==t[kl+1][f].maxx&&!t[k][f].check)
    {
        t[k][f].rmaxx=t[kl+1][f].len+t[kl][f].rmaxx;
    }
    else
    {
        t[k][f].rmaxx=t[kl+1][f].rmaxx;
    }
    t[k][f].maxx=max(t[kl][f].maxx,t[kl+1][f].maxx);
    if(!t[k][f].check)
    t[k][f].maxx=max(t[kl][f].rmaxx+t[kl+1][f].lmaxx,t[k][f].maxx);
}
void bu(int k,int l,int r,int f)
{
    t[k][f].len=t[k][f].lmaxx=t[k][f].maxx=t[k][f].rmaxx=r-l+1;
//	cout<<k<<' '<<l<<' '<<r<<endl;
    if(l==r)
    return;
    bu(kl,l,mid,f);
    bu(kl+1,mid+1,r,f);
}
void ch(int k,int l,int r,int f)
{
//	pd(k,l,r);
	if(mid==x)
	{
		t[k][f].maxx=max(t[kl][f].maxx,t[kl+1][f].maxx);
		t[k][f].lmaxx=t[kl][f].lmaxx;
		t[k][f].rmaxx=t[kl+1][f].rmaxx;
		t[k][f].check=true;
		return;
    }
/*	if(t[k][f].len==3)
	{
		t[k][f].maxx=t[kl+1][f].maxx;
		t[k][f].lmaxx=1;
		t[k][f].rmaxx=t[kl+1][f].rmaxx;
		t[k][f].check=true;
		return;
	}
*/	if(x<mid)
    ch(kl,l,mid,f);
	else if(x>mid)
    ch(kl+1,mid+1,r,f);
    ud(k,l,r,f);
}
void se(int k,int l,int r,int f)
{
	cout<<t[k][f].maxx<<' '<<k<<endl;
	if(l==r)
	return;
	se(kl,l,mid,f);
	se(kl+1,mid+1,r,f);

}
int main()
{
//	freopen("qwq.out","w",stdout);
    cin>>w>>h>>n;

	bu(1,1,w,1);
	bu(1,1,h,2);
    for(int i=1;i<=n;i++)
    {
		scanf("%c",&c);
		scanf("%c",&c);
		if(c=='H')
        {
        	cin>>x;
        	x=h-x;
            ch(1,1,h,2);
        }
        else
        {
        	cin>>x;
			ch(1,1,w,1);
        }
//        se(1,1,w,1);
//		se(1,1,h,2);
 //cout<<t[1][1].maxx ;
        cout<<(long long)t[1][1].maxx*t[1][2].maxx<<endl;
    }
    return 0;
}
/*
4 3 4
H 2
V 2
V 3
V 1
*/


#include <map>
#include <set>
#include <iostream>
using namespace std;

long long w,h,n;
multiset<long long> heng;
multiset<long long> shu;
map<int,int> mh,mw;
string cut;
long long cutn;
long long maxw,maxh;

int main(){
	cin>>w>>h>>n;
	mh[0]=h;
	mw[0]=w;
	maxw=w;
	maxh=h;
	heng.insert(h);
	shu.insert(w);
	for(int i=0;i<n;i++){
		cin>>cut>>cutn;
		if(cut=="H"){
			map<long long,long long>::iterator it= mh.lower_bound(cutn);
			--it;
			pair<long long,long long> s1 = make_pair(it->first,cutn);
			pair<long long,long long> s2 = make_pair(cutn,it->second);
			heng.erase(heng.find(it->second-it->first));
			mh.erase(it);
			mh.insert(s1);mh.insert(s2);
		    heng.insert(s1.second-s1.first);
			heng.insert(s2.second-s2.first);
			maxh=*--heng.end();
		    cout<<maxw*maxh<<endl;
		}
		if(cut=="V"){
			map<long long,long long>::iterator it= mw.lower_bound(cutn);
			--it;
			pair<long long,long long> s1 = make_pair(it->first,cutn);
			pair<long long,long long> s2 = make_pair(cutn,it->second);
			shu.erase(shu.find(it->second-it->first));
			mw.erase(it);
			mw.insert(s1);mw.insert(s2);
			shu.insert(s1.second-s1.first);
			shu.insert(s2.second-s2.first);
            maxw=*--shu.end();
		    cout<<maxw*maxh<<endl;
		}
	}
}


#include<bits/stdc++.h>
typedef int mainint;
using namespace std;
int W,H,n,L,R,k,maxx,maxy;
char op[2];
set<int>X,Y;
multiset<int>lenx,leny;
multiset<int>::iterator it;
int main()
{
    cin >> W >> H >> n;
    lenx.insert(W),leny.insert(H);
    X.insert(0),X.insert(W),Y.insert(0),Y.insert(H);
    for (int i=1;i<=n;++i)
	{
        scanf("%s",op),cin >> k;
        if(op[0]=='H')
		{
            Y.insert(k),it=Y.find(k),--it,L=*it,++it,++it,R=*it;
            leny.erase(leny.find(R-L)),leny.insert(k-L),leny.insert(R-k);
        }
        else
		{
            X.insert(k),it=X.find(k),--it,L=*it,++it,++it,R=*it;
            lenx.erase(lenx.find(R-L)),lenx.insert(k-L),lenx.insert(R-k);
        }
        it=lenx.end(),--it,maxx=*it;
        it=leny.end(),--it,maxy=*it;
        printf("%lld\n",maxx*maxy);
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
set<int >Ws,Hs;
multiset<int >wms,hms;
int main()
{
	int w,h,n,m;
	char ch;
	scanf("%d %d %d",&w,&h,&n);
	Ws.insert(0);
	Ws.insert(w);
	Hs.insert(0);
	Hs.insert(h);
	wms.insert(w);
	hms.insert(h);
	for(int i=1;i<=n;i++){
		scanf(" %c %d",&ch,&m);
		if(ch=='H'){
			Hs.insert(m);
			int l=*(--Hs.find(m));
			int r=*(++Hs.find(m));
			hms.erase(hms.find(r-l));
			hms.insert(r-m);
			hms.insert(m-l);
		}else{
			Ws.insert(m);
			int l=*(--Ws.find(m));
			int r=*(++Ws.find(m));
			wms.erase(wms.find(r-l));
			wms.insert(r-m);
			wms.insert(m-l);
		}
		long long ww=*(--wms.end());
		long long hh=*(--hms.end());
		printf("%I64d\n",ww*hh);
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
set<int>ws,hs;
multiset<int>wms,hms;
int main()
{
	int w,h,n,m;
	char ch;
	scanf("%d %d %d",&w,&h,&n);
	ws.insert(0);
	ws.insert(w);
	hs.insert(0);
	hs.insert(h);
	wms.insert(w);
	hms.insert(h);
	for(int i=1;i<=n;i++){
		scanf(" %c %d",&ch,&m);
		if(ch=='H'){
			hs.insert(m);
			int s=hs.find(m)-1;
			int d=s+2;
			hms.erase(hms.find(*d-*s));
			hms.insert(*d-m);
			hms.insert(m-*s);
		}else{
			ws.insert(m);
			int s=ws.find(m)-1;
			int d=s+2;
			wms.erase(wms.find(*d-*s));
			wms.insert(*d-m);
			wms.insert(m-*s);
		}
		long long maxh=*(--hms.end());
		long long maxw=*(--wms.end());
		printf("%I64d\n",maxh*maxw);
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
set<int> Ws,Hs;
multiset<int> wms,hms;
int main()
{
	int w,h,n,m;
	char ch;
	scanf("%d %d %d",&w,&h,&n);
	Ws.insert(0);
	Ws.insert(w);
	Hs.insert(0);
	Hs.insert(h);
	wms.insert(w);
	hms.insert(h);
	for(int i=1;i<=n;i++){
		scanf(" %c %d",&ch,&m);
		if(ch=='H'){
			Hs.insert(m);
			int s=*(--Hs.find(m));
			int d=*(++Hs.find(m));
			hms.erase(hms.find(d-s));
			hms.insert(d-m);
			hms.insert(m-s);
		}else{
			Ws.insert(m);
			int s=*(--Ws.find(m));
			int d=*(++Ws.find(m));
			wms.erase(wms.find(d-s));
			wms.insert(d-m);
			wms.insert(m-s);
		}
		long long maxh=*(--hms.end());
		long long maxw=*(--wms.end());
		printf("%I64d\n",maxh*maxw);
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
set<int >ws,hs;
multiset<int >wms,hms;
int main()
{
	int w,h,n,m;
	char ch;
	scanf("%d %d %d",&w,&h,&n);
	ws.insert(0);
	ws.insert(w);
	hs.insert(0);
	hs.insert(h);
	wms.insert(w);
	hms.insert(h);
	for(int i=1;i<=n;i++){
		scanf(" %c %d",&ch,&m);
		if(ch=='H'){
			hs.insert(m);
			int l=*(--hs.find(m));
			int r=*(++hs.find(m));
			hms.erase(hms.find(r-l));
			hms.insert(r-d);
			hms.insert(d-l);
		}else{
			ws.insert(m);
			int l=*(--ws.find(m));
			int r=*(++ws.find(m));
			wms.erase(wms.find(r-l));
			wms.insert(r-d);
			wms.insert(d-l);
		}
		long long ww=*(--wms.end())
		long long hh=*(--hms.end());
		printf("%I64d\n",ww*hh);
	}
	return 0;
}


#include<bits/stdc++.h>
#include<iostream>
#include<map>
#include<set>
#include<vector>
#include<cstring>
#include<cmath>

using namespace std;

#define sf scanf
#define pf printf
#define ll long long
#define fr(I,M,N) for(I=M;I<=N;I++)
#define fr_(I,M,N) for(I=M;I>=N;I--)
#define re return
#define sfn cin>>n
#define bal cout<<x<<endl
#define pb push_back
#define ins insert
#define sz(X) X.size()
#define xx first
#define yy second

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);
    int i,j,x,k,n,h,w,ans;
    int len,pos;
    cin>>w>>h>>n;
    vector<int> xnod,ynod,tv,wha;
    map<int,int> xval,yval;
    map<int,int> :: iterator it;
    map<int,int> xch,ych;
    char dec;
    xnod.pb(0);xnod.pb(w);
    ynod.pb(0);ynod.pb(h);
    xval[w]=1;
    yval[h]=1;
    xch[w]++;
    ych[h]++;
    fr(i,1,n)
    {
        set<int> :: iterator it;
        cin>>dec>>x;
        if(dec=='H')
        {
            tv=ynod;
            pos=0;
            while(sz(tv)>2)
            {
                k=sz(tv)/2-1;
                if(sz(tv)%2!=0) k++;
                if(x>=tv[k] && x<tv[k+1])
                {
                    pos+=k;
                    vector<int> wha(tv.begin()+k,tv.begin()+k+1);
                }
                else if(x>=tv[k])
                {
                    pos+=k;
                    vector<int> wha(tv.begin()+k,tv.end());
                }
                else
                {
                    vector<int> wha(tv.begin(),tv.begin()+k+1);
                }
                tv=wha;
            }
            if(ynod[pos+1]<x) pos++;
            ych[abs(ynod[pos+1]-ynod[pos])]--;
            ynod.insert(ynod.begin()+pos+1,x);
            ych[abs(ynod[pos+1]-ynod[pos])]++;
            ych[abs(ynod[pos+2]-ynod[pos+1])]++;
            yval[abs(ynod[pos+1]-ynod[pos])]=1;
            yval[abs(ynod[pos+2]-ynod[pos+1])]=1;
            while(!yval.empty())
            {
                x=yval.rbegin()->xx;
                if(ych[x])
                {
                    break;
                }
                yval.erase(x);
            }
        }
        else
        {
            tv=xnod;
            pos=0;
            while(sz(tv)>2)
            {
                k=sz(tv)/2-1;
                if(sz(tv)%2!=0) k++;
                if(x>=tv[k] && x<tv[k+1])
                {
                    pos+=k;
                    vector<int> wha(tv.begin()+k,tv.begin()+k+1);
                }
                else if(x>=tv[k])
                {
                    pos+=k;
                    vector<int> wha(tv.begin()+k,tv.end());
                }
                else
                {
                    vector<int> wha(tv.begin(),tv.begin()+k+1);
                }
                tv=wha;
            }
            if(xnod[pos+1]<x) pos++;
            xch[abs(xnod[pos+1]-xnod[pos])]--;
            xnod.insert(xnod.begin()+pos+1,x);
            xch[abs(xnod[pos+1]-xnod[pos])]++;
            xch[abs(xnod[pos+2]-xnod[pos+1])]++;
            xval[abs(xnod[pos+1]-xnod[pos])]=1;
            xval[abs(xnod[pos+2]-xnod[pos+1])]=1;
            while(!xval.empty())
            {
                x=xval.rbegin()->xx;
                if(xch[x])
                {
                    break;
                }
                xval.erase(x);
            }
        }
        ans=xval.rbegin()->xx;
        x=yval.rbegin()->xx;
        ans=ans*x;
        cout<<ans<<endl;
    }
}


#include<bits/stdc++.h>
#include<iostream>
#include<map>
#include<set>
#include<vector>
#include<cstring>
#include<cmath>

using namespace std;

#define sf scanf
#define pf printf
#define ll long long
#define fr(I,M,N) for(I=M;I<=N;I++)
#define fr_(I,M,N) for(I=M;I>=N;I--)
#define re return
#define sfn cin>>n
#define bal cout<<x<<endl
#define pb push_back
#define ins insert
#define sz(X) X.size()
#define xx first
#define yy second

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);
    int i,j,x,k,n,h,w,ans,u,d;
    int len,pos;
    cin>>w>>h>>n;
    map<int,int> xnod,ynod;
    map<int,int> xval,yval;
    map<int,int> :: iterator it;
    map<int,int> xch,ych;
    char dec;
    xnod[0]=1;xnod[w]=1;
    ynod[0]=1;ynod[h]=1;
    xval[w]=1;
    yval[h]=1;
    xch[w]++;
    ych[h]++;
    fr(i,1,n)
    {
        cin>>dec>>x;
        if(dec=='H')
        {
            it=ynod.lower_bound(x);
            u=it->xx;
            it--;
            d=it->xx;
            ynod[x]=1;
            ych[abs(u-d)]--;
            ych[abs(u-x)]++;
            ych[abs(d-x)]++;
            yval[abs(u-x)]=1;
            yval[abs(d-x)]=1;
            if(!ych[abs(u-d)])
                yval.erase(abs(u-d));
            /*while(!yval.empty())
            {
                x=yval.rbegin()->xx;
                if(ych[x])
                {
                    break;
                }
                yval.erase(x);
            }*/
        }
        else
        {
            it=xnod.lower_bound(x);
            u=it->xx;
            it--;
            d=it->xx;
            xnod[x]=1;
            xch[abs(u-d)]--;
            xch[abs(u-x)]++;
            xch[abs(d-x)]++;
            xval[abs(u-x)]=1;
            xval[abs(d-x)]=1;
            if(!xch[abs(u-d)])
                xval.erase(abs(u-d));
            /*while(!xval.empty())
            {
                x=xval.rbegin()->xx;
                if(xch[x])
                {
                    break;
                }
                xval.erase(x);
            }*/
        }
        ans=xval.rbegin()->xx;
        x=yval.rbegin()->xx;
        ans=ans*x;
        cout<<ans<<endl;
    }
}


#include<bits/stdc++.h>
#include<iostream>
#include<map>
#include<set>
#include<vector>
#include<cstring>
#include<cmath>

using namespace std;

#define sf scanf
#define pf printf
#define ll long long
#define fr(I,M,N) for(I=M;I<=N;I++)
#define fr_(I,M,N) for(I=M;I>=N;I--)
#define re return
#define sfn cin>>n
#define bal cout<<x<<endl
#define pb push_back
#define ins insert
#define sz(X) X.size()
#define xx first
#define yy second

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);
    int i,j,x,k,n,h,w,ans;
    int len,pos;
    cin>>w>>h>>n;
    vector<int> xnod,ynod,tv,wha;
    map<int,int> xval,yval;
    map<int,int> :: iterator it;
    map<int,int> xch,ych;
    char dec;
    xnod.pb(0);xnod.pb(w);
    ynod.pb(0);ynod.pb(h);
    xval[w]=1;
    yval[h]=1;
    xch[w]++;
    ych[h]++;
    fr(i,1,n)
    {
        cin>>dec>>x;
        if(dec=='H')
        {
            tv=ynod;
            pos=0;
            while(sz(tv)>2)
            {
                k=sz(tv)/2-1;
                if(sz(tv)%2!=0) k++;
                if(x>=tv[k] && x<tv[k+1])
                {
                    pos+=k;
                    tv.erase(tv.begin(),tv.begin()+k);
                    tv.erase(tv.begin()+k+2,tv.end());
                }
                else if(x>=tv[k])
                {
                    pos+=k;
                    tv.erase(tv.begin(),tv.begin()+k+1);
                }
                else
                {
                    tv.erase(tv.begin()+k,tv.end());
                }
            }
            while(ynod[pos+1]<x) pos++;
            ych[abs(ynod[pos+1]-ynod[pos])]--;
            ynod.insert(ynod.begin()+pos+1,x);
            ych[abs(ynod[pos+1]-ynod[pos])]++;
            ych[abs(ynod[pos+2]-ynod[pos+1])]++;
            yval[abs(ynod[pos+1]-ynod[pos])]=1;
            yval[abs(ynod[pos+2]-ynod[pos+1])]=1;
            while(!yval.empty())
            {
                x=yval.rbegin()->xx;
                if(ych[x])
                {
                    break;
                }
                yval.erase(x);
            }
        }
        else
        {
            tv=xnod;
            pos=0;
            while(sz(tv)>2)
            {
                k=sz(tv)/2-1;
                if(sz(tv)%2!=0) k++;
                if(x>=tv[k] && x<tv[k+1])
                {
                    pos+=k;
                    tv.erase(tv.begin(),tv.begin()+k);
                    tv.erase(tv.begin()+k+2,tv.end());
                }
                else if(x>=tv[k])
                {
                    pos+=k;
                    tv.erase(tv.begin(),tv.begin()+k+1);
                }
                else
                {
                    tv.erase(tv.begin()+k,tv.end());
                }
            }
            while(xnod[pos+1]<x) pos++;
            xch[abs(xnod[pos+1]-xnod[pos])]--;
            xnod.insert(xnod.begin()+pos+1,x);
            xch[abs(xnod[pos+1]-xnod[pos])]++;
            xch[abs(xnod[pos+2]-xnod[pos+1])]++;
            xval[abs(xnod[pos+1]-xnod[pos])]=1;
            xval[abs(xnod[pos+2]-xnod[pos+1])]=1;
            while(!xval.empty())
            {
                x=xval.rbegin()->xx;
                if(xch[x])
                {
                    break;
                }
                xval.erase(x);
            }
        }
        ans=xval.rbegin()->xx;
        x=yval.rbegin()->xx;
        ans=ans*x;
        cout<<ans<<endl;
    }
}


#include<bits/stdc++.h>
#include<iostream>
#include<map>
#include<set>
#include<vector>
#include<cstring>
#include<cmath>

using namespace std;

#define sf scanf
#define pf printf
#define ll long long
#define fr(I,M,N) for(I=M;I<=N;I++)
#define fr_(I,M,N) for(I=M;I>=N;I--)
#define re return
#define sfn cin>>n
#define bal cout<<x<<endl
#define pb push_back
#define ins insert
#define sz(X) X.size()
#define xx first
#define yy second

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);
    ll int i,j,x,k,n,h,w,ans,u,d;
    cin>>w>>h>>n;
    map<ll int,ll int> xnod,ynod;
    map<ll int,ll int> xval,yval;
    map<ll int,ll int> :: iterator it;
    map<ll int,ll int> xch,ych;
    char dec;
    xnod[0]=1;xnod[w]=1;
    ynod[0]=1;ynod[h]=1;
    xval[w]=1;
    yval[h]=1;
    xch[w]++;
    ych[h]++;
    fr(i,1,n)
    {
        cin>>dec>>x;
        if(dec=='H')
        {
            it=ynod.lower_bound(x);
            u=it->xx;
            it--;
            d=it->xx;
            ynod[x]=1;
            ych[abs(u-d)]--;
            ych[abs(u-x)]++;
            ych[abs(d-x)]++;
            yval[abs(u-x)]=1;
            yval[abs(d-x)]=1;
            if(!ych[abs(u-d)])
                yval.erase(abs(u-d));
            /*while(!yval.empty())
            {
                x=yval.rbegin()->xx;
                if(ych[x])
                {
                    break;
                }
                yval.erase(x);
            }*/
        }
        else
        {
            it=xnod.lower_bound(x);
            u=it->xx;
            it--;
            d=it->xx;
            xnod[x]=1;
            xch[abs(u-d)]--;
            xch[abs(u-x)]++;
            xch[abs(d-x)]++;
            xval[abs(u-x)]=1;
            xval[abs(d-x)]=1;
            if(!xch[abs(u-d)])
                xval.erase(abs(u-d));
            /*while(!xval.empty())
            {
                x=xval.rbegin()->xx;
                if(xch[x])
                {
                    break;
                }
                xval.erase(x);
            }*/
        }
        ans=xval.rbegin()->xx;
        x=yval.rbegin()->xx;
        ans=ans*x;
        cout<<ans<<endl;
    }
}


#include<bits/stdc++.h>
#include<iostream>
#include<map>
#include<set>
#include<vector>
#include<cstring>
#include<cmath>

using namespace std;

#define sf scanf
#define pf printf
#define ll long long
#define fr(I,M,N) for(I=M;I<=N;I++)
#define fr_(I,M,N) for(I=M;I>=N;I--)
#define re return
#define sfn cin>>n
#define bal pf("bal\n")
#define pb push_back
#define ins insert
#define sz(X) X.size()
#define xx first
#define yy second

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);
    int i,j,x,n,h,w,mxx,mnx=0,mxy,mny=0;
    int len;
    cin>>w>>h>>n;
    vector<int> xct,yct;
    xct.pb(h);
    xct.pb(0);
    yct.pb(0);
    yct.pb(w);
    mxx=h;
    mxy=w;
    char dec;
    fr(i,1,n)
    {
        cin>>dec>>x;
        if(dec=='H')
        {
            yct.pb(x);
            x=sz(yct);
            sort(yct.begin(),yct.end());
            mxx=0;
            fr(j,0,x-2)
            {
                mxx=max(yct[j+1]-yct[j],mxx);
            }
        }
        else
        {
            xct.pb(x);
            x=sz(xct);
            sort(xct.begin(),xct.end());
            mxy=0;
            fr(j,0,x-2)
            {
                mxy=max(xct[j+1]-xct[j],mxy);
            }
        }
        cout<<mxx*mxy<<endl;
    }
}


#include<bits/stdc++.h>
#include<iostream>
#include<map>
#include<set>
#include<vector>
#include<cstring>
#include<cmath>

using namespace std;

#define sf scanf
#define pf printf
#define ll long long
#define fr(I,M,N) for(I=M;I<=N;I++)
#define fr_(I,M,N) for(I=M;I>=N;I--)
#define re return
#define sfn cin>>n
#define bal cout<<x<<endl
#define pb push_back
#define ins insert
#define sz(X) X.size()
#define xx first
#define yy second

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);
    int i,j,x,k,n,h,w,ans;
    int len,pos;
    cin>>w>>h>>n;
    vector<int> xnod,ynod,tv,wha;
    map<int,int> xval,yval;
    map<int,int> :: iterator it;
    map<int,int> xch,ych;
    char dec;
    xnod.pb(0);xnod.pb(w);
    ynod.pb(0);ynod.pb(h);
    xval[w]=1;
    yval[h]=1;
    xch[w]++;
    ych[h]++;
    fr(i,1,n)
    {
        cin>>dec>>x;
        if(dec=='H')
        {
            tv=ynod;
            pos=0;
            while(sz(tv)>2)
            {
                k=sz(tv)/2-1;
                if(sz(tv)%2!=0) k++;
                if(x>=tv[k] && x<tv[k+1])
                {
                    pos+=k;
                    vector<int> wha(tv.begin()+k,tv.begin()+k+1);
                }
                else if(x>=tv[k])
                {
                    pos+=k;
                    vector<int> wha(tv.begin()+k,tv.end());
                }
                else
                {
                    vector<int> wha(tv.begin(),tv.begin()+k+1);
                }
                tv=wha;
            }
            while(ynod[pos+1]<x) pos++;
            ych[abs(ynod[pos+1]-ynod[pos])]--;
            ynod.insert(ynod.begin()+pos+1,x);
            ych[abs(ynod[pos+1]-ynod[pos])]++;
            ych[abs(ynod[pos+2]-ynod[pos+1])]++;
            yval[abs(ynod[pos+1]-ynod[pos])]=1;
            yval[abs(ynod[pos+2]-ynod[pos+1])]=1;
            while(!yval.empty())
            {
                x=yval.rbegin()->xx;
                if(ych[x])
                {
                    break;
                }
                yval.erase(x);
            }
        }
        else
        {
            tv=xnod;
            pos=0;
            while(sz(tv)>2)
            {
                k=sz(tv)/2-1;
                if(sz(tv)%2!=0) k++;
                if(x>=tv[k] && x<tv[k+1])
                {
                    pos+=k;
                    vector<int> wha(tv.begin()+k,tv.begin()+k+1);
                }
                else if(x>=tv[k])
                {
                    pos+=k;
                    vector<int> wha(tv.begin()+k,tv.end());
                }
                else
                {
                    vector<int> wha(tv.begin(),tv.begin()+k+1);
                }
                tv=wha;
            }
            while(xnod[pos+1]<x) pos++;
            xch[abs(xnod[pos+1]-xnod[pos])]--;
            xnod.insert(xnod.begin()+pos+1,x);
            xch[abs(xnod[pos+1]-xnod[pos])]++;
            xch[abs(xnod[pos+2]-xnod[pos+1])]++;
            xval[abs(xnod[pos+1]-xnod[pos])]=1;
            xval[abs(xnod[pos+2]-xnod[pos+1])]=1;
            while(!xval.empty())
            {
                x=xval.rbegin()->xx;
                if(xch[x])
                {
                    break;
                }
                xval.erase(x);
            }
        }
        ans=xval.rbegin()->xx;
        x=yval.rbegin()->xx;
        ans=ans*x;
        cout<<ans<<endl;
    }
}


#include<bits/stdc++.h>
#include<iostream>
#include<map>
#include<set>
#include<vector>
#include<cstring>
#include<cmath>

using namespace std;

#define sf scanf
#define pf printf
#define ll long long
#define fr(I,M,N) for(I=M;I<=N;I++)
#define fr_(I,M,N) for(I=M;I>=N;I--)
#define re return
#define sfn cin>>n
#define bal cout<<x<<endl
#define pb push_back
#define ins insert
#define sz(X) X.size()
#define xx first
#define yy second

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);
    int i,j,x,k,n,h,w,ans;
    int len,pos;
    cin>>w>>h>>n;
    vector<int> xnod,ynod,tv,wha;
    map<int,int> xval,yval;
    map<int,int> :: iterator it;
    map<int,int> xch,ych;
    char dec;
    xnod.pb(0);xnod.pb(w);
    ynod.pb(0);ynod.pb(h);
    xval[w]=1;
    yval[h]=1;
    xch[w]++;
    ych[h]++;
    fr(i,1,n)
    {
        cin>>dec>>x;
        if(dec=='H')
        {
            tv=ynod;
            pos=0;
            while(sz(tv)>2)
            {
                k=sz(tv)/2-1;
                if(sz(tv)%2!=0) k++;
                if(x>=tv[k] && x<tv[k+1])
                {
                    pos+=k;
                    vector<int> wha(tv.begin()+k,tv.begin()+k+1);
                }
                else if(x>=tv[k])
                {
                    pos+=k;
                    tv.erase(tv.begin(),tv.begin()+k+1);
                }
                else
                {
                    tv.erase(tv.begin()+k,tv.end());
                }
            }
            while(ynod[pos+1]<x) pos++;
            ych[abs(ynod[pos+1]-ynod[pos])]--;
            ynod.insert(ynod.begin()+pos+1,x);
            ych[abs(ynod[pos+1]-ynod[pos])]++;
            ych[abs(ynod[pos+2]-ynod[pos+1])]++;
            yval[abs(ynod[pos+1]-ynod[pos])]=1;
            yval[abs(ynod[pos+2]-ynod[pos+1])]=1;
            while(!yval.empty())
            {
                x=yval.rbegin()->xx;
                if(ych[x])
                {
                    break;
                }
                yval.erase(x);
            }
        }
        else
        {
            tv=xnod;
            pos=0;
            while(sz(tv)>2)
            {
                k=sz(tv)/2-1;
                if(sz(tv)%2!=0) k++;
                if(x>=tv[k] && x<tv[k+1])
                {
                    pos+=k;
                    vector<int> wha(tv.begin()+k,tv.begin()+k+1);
                }
                else if(x>=tv[k])
                {
                    pos+=k;
                    tv.erase(tv.begin(),tv.begin()+k+1);
                }
                else
                {
                    tv.erase(tv.begin()+k,tv.end());
                }
            }
            while(xnod[pos+1]<x) pos++;
            xch[abs(xnod[pos+1]-xnod[pos])]--;
            xnod.insert(xnod.begin()+pos+1,x);
            xch[abs(xnod[pos+1]-xnod[pos])]++;
            xch[abs(xnod[pos+2]-xnod[pos+1])]++;
            xval[abs(xnod[pos+1]-xnod[pos])]=1;
            xval[abs(xnod[pos+2]-xnod[pos+1])]=1;
            while(!xval.empty())
            {
                x=xval.rbegin()->xx;
                if(xch[x])
                {
                    break;
                }
                xval.erase(x);
            }
        }
        ans=xval.rbegin()->xx;
        x=yval.rbegin()->xx;
        ans=ans*x;
        cout<<ans<<endl;
    }
}


#include<bits/stdc++.h>
#include<iostream>
#include<map>
#include<set>
#include<vector>
#include<cstring>
#include<cmath>

using namespace std;

#define sf scanf
#define pf printf
#define ll long long
#define fr(I,M,N) for(I=M;I<=N;I++)
#define fr_(I,M,N) for(I=M;I>=N;I--)
#define re return
#define sfn cin>>n
#define bal pf("bal\n")
#define pb push_back
#define ins insert
#define sz(X) X.size()
#define xx first
#define yy second

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);
    int i,j,x,n,h,w,mxx,mnx=0,mxy,mny=0;
    int len;
    cin>>w>>h>>n;
    vector<int> xct,yct;
    xct.pb(w);
    xct.pb(0);
    yct.pb(0);
    yct.pb(h);
    mxx=w;
    mxy=h;
    char dec;
    fr(i,1,n)
    {
        cin>>dec>>x;
        if(dec=='H')
        {
            yct.pb(x);
            x=sz(yct);
            sort(yct.begin(),yct.end());
            mxy=0;
            fr(j,0,x-2)
            {
                mxy=max(yct[j+1]-yct[j],mxy);
            }
        }
        else
        {
            xct.pb(x);
            x=sz(xct);
            sort(xct.begin(),xct.end());
            mxx=0;
            fr(j,0,x-2)
            {
                mxx=max(xct[j+1]-xct[j],mxx);
            }
        }
        cout<<mxx*mxy<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
const int maxn=200010;
multiset<int>H,V;
int mh[maxn],mv[maxn];
void cut(multiset<int>&s,int *a,int val){
    s.insert(val);
    set<int>::iterator l,r;
    l=r=s.find(val);
    l--;
	r++;
    a[*r-*l]--;
    a[*r-val]++;
    a[val-*l]++;
}
int main(){
	int n,h,v,x,maxh,maxv;
    scanf("%d %d %d",&v,&h,&n);
    mh[h]=1;
	mv[v]=1;
    H.insert(h);
	V.insert(v);
    H.insert(0);
	V.insert(0);
    maxh=h;
	maxv=v;
    char ch;
    while(n--){
    	cin >> ch;
        scanf("%d",&x);
        ch=='H'?cut(H,mh,x):cut(V,mv,x);
        while(!mh[maxh]) maxh--;
        while(!mv[maxv]) maxv--;
        long long ans=(long long)(maxh*maxv);
        printf("%lld\n",ans);
    }
    return 0;
}


#include<iostream>
#include<set>
using namespace std;
multiset<long long> xst , yst;//两个最优间距,x竖y横
set<long long> st1 , st2;//切痕储存,2横切1竖切
long long w , h , n , a;
long long w1 , w2;
char wy;
int main(){
	cin >> w >> h >> n;
	st1.insert(w);
	st1.insert(0);
	yst.insert(w);
	//初始化宽度边界
	st2.insert(h);
	st2.insert(0);
	xst.insert(h);
	//初始化宽度边界
	for(int i =1 ; i <= n ; i++){
		cin >> wy >> a;
		set<long long>::iterator it;
		if(wy=='H'){
			it = st2.upper_bound(a);
			w1 = *it , w2 = *(--it);
			xst.erase(xst.find(w1 - w2));
			xst.insert(w1 - a);
			xst.insert(a - w2);
			st2.insert(a);
		}//打横切
		else{
			it = st1.upper_bound(a);
			w1 = *it , w2 = *(--it);
			yst.erase(yst.find(w1 - w2));
			yst.insert(w1 - a);
			yst.insert(a - w2);
			st1.insert(a);
		}//打竖切

		cout << *(xst.rbegin())*(*(yst.rbegin())) << endl;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int w,h,n,t;
set<long long>lx,ly;
multiset<long long>x,y;
multiset<long long>::iterator it;
char c;
int main()
{
    scanf("%d%d%d",&w,&h,&n);
    x.insert(w);
    y.insert(h);
    lx.insert(0);lx.insert(w);
    ly.insert(0);ly.insert(h);
    for(int i=1;i<=n;++i)
    {
        cin>>c>>t;
        if(c=='H')
        {
            ly.insert(t);
            it=ly.find(t);
            --it;
            long long l=*it;置
            ++it;++it;
            long long r=*it;
            it=y.find(r-l);
            y.erase(it);
            y.insert(r-t);
            y.insert(t-l);
        }
        else
        {
            lx.insert(t);
            it=lx.find(t);
            --it;
            int l=*it;
            ++it;++it;
            int r=*it;
            it=x.find(r-l);
            x.erase(it);
            x.insert(r-t);
            x.insert(t-l);
        }
        it=x.end();it--;
        long long l=*it;
        it=y.end();it--;
        long long r=*it;
        cout<<(long long)(l*r)<<endl;
    }
    return 0;
}


#20399433 | xjcj02's solution for [CodeForces-527C] [Problem D]
Status
	Accepted
Time
	1216ms
Memory
	12744kB
Length
	1366
Lang
	GNU G++17 7.3.0
Submitted
	2019-07-13 12:21:03
Shared

RemoteRunId
	56955185
Select Code

#include <bits/stdc++.h>
using namespace std ;
set<int> cx;
set<int> cy;
multiset<int> fx;
multiset<int> fy;

int main(){
    int n,m,qwq;
    cin >> n >> m >> qwq ;
    cx.insert(0);cx.insert(n);
    cy.insert(0);cy.insert(m);
    fx.insert(n);fy.insert(m);
    while(qwq--){
        char c;
        int a;
        cin >> c >> a ;
        //cout << c << endl ;
        //cout << a;
        if(c=='H'){
            cy.insert(a);
            set<int>::iterator it;
            it=cy.find(a);
            set<int>::iterator itl;
            itl=--it;
            set<int>::iterator itr;
            itr=++++it;
            multiset<int>::iterator itpr;
            itpr=fy.find(*itr-*itl);
            fy.erase(itpr);
            fy.insert(a-*itl);
            fy.insert(*itr-a);
        }else{
            cx.insert(a);
            set<int>::iterator it;
            it=cx.find(a);
            set<int>::iterator itl;
            itl=--it;
            set<int>::iterator itr;
            itr=++++it;
            multiset<int>::iterator itpr;
            itpr=fx.find(*itr-*itl);
            fx.erase(itpr);
            fx.insert(a-*itl);
            fx.insert(*itr-a);
        }
        multiset<int>::iterator t1,t2;
        t1=fx.end();t1--;
        t2=fy.end();t2--;
        long long ans;
        ans =(long long)(*t1)*(*t2);
        printf("%lld\n",ans);
    }
}


#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<map>
#include<string>
#include<vector>
#include<queue>
#define kl (k*2)
#define mid ((l+r)/2)
#define sum （r-l+1)
using namespace std;
long long n,m,x,y,q,p,h,w;
char c;
struct tree{
    long long lazy,maxx,lmaxx,rmaxx,len;
    bool check;
}t[2000000][4];
void ud(int k,int l,int r,int f)
{
    if(t[kl][f].maxx==t[kl][f].len&&!t[k][f].check)
    {
        t[k][f].lmaxx=t[kl][f].len+t[kl+1][f].lmaxx;
    }
    else
    {
        t[k][f].lmaxx=t[kl][f].lmaxx;
    }
    if(t[kl+1][f].len==t[kl+1][f].maxx&&!t[k][f].check)
    {
        t[k][f].rmaxx=t[kl+1][f].len+t[kl][f].rmaxx;
    }
    else
    {
        t[k][f].rmaxx=t[kl+1][f].rmaxx;
    }
    t[k][f].maxx=max(t[kl][f].maxx,t[kl+1][f].maxx);
    if(!t[k][f].check)
    t[k][f].maxx=max(t[kl][f].rmaxx+t[kl+1][f].lmaxx,t[k][f].maxx);
}
void bu(int k,int l,int r,int f)
{
    t[k][f].len=t[k][f].lmaxx=t[k][f].maxx=t[k][f].rmaxx=r-l+1;
//	cout<<k<<' '<<l<<' '<<r<<endl;
    if(l==r)
    return;
    bu(kl,l,mid,f);
    bu(kl+1,mid+1,r,f);
}
void ch(int k,int l,int r,int f)
{
//	pd(k,l,r);
	if(mid==x)
	{
		t[k][f].maxx=max(t[kl][f].maxx,t[kl+1][f].maxx);
		t[k][f].lmaxx=t[kl][f].lmaxx;
		t[k][f].rmaxx=t[kl+1][f].rmaxx;
		t[k][f].check=true;
		return;
    }
    if(t[k][f].len==3)
	{
		t[k][f].maxx=t[kl+1][f].maxx;
		t[k][f].lmaxx=1;
		t[k][f].rmaxx=t[kl+1][f].rmaxx;
		t[k][f].check=true;
		return;
	}
    if(x<mid)
    ch(kl,l,mid,f);
	else if(x>mid)
    ch(kl+1,mid+1,r,f);
    ud(k,l,r,f);
}
int main()
{
//	freopen("qwq.out","w",stdout);
    cin>>w>>h>>n;

	bu(1,1,w,1);
	bu(1,1,h,2);
    for(int i=1;i<=n;i++)
    {
		scanf("%c",&c);
		scanf("%c",&c);
		if(c=='H')
        {
        	cin>>x;
        	x=h-x;
            ch(1,1,h,2);
        }
        else
        {
        	cin>>x;
			ch(1,1,w,1);
        }
        cout<<t[1][1].maxx*t[1][2].maxx<<endl;
    }
    return 0;
}
/*
4 3 4
H 2
V 2
V 3
V 1
*/


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

ll w, h, n, square;
ll loc;

multiset<int> a; //横边集
multiset<int> b; //竖边集

set<int> x; //纵切 -> 横边
set<int> y; //横切 -> 竖边

set<int>::iterator it, pre, nxt;
multiset<int>::iterator tmp;

//ll abss(ll p) { return p >= 0 ? p : -p; }

void heng(int l) //y,b
{
    it = pre = nxt = y.find(l);
    nxt++;
    pre--;
    int len = (*nxt) - (*pre);
    //cout << *nxt<<*it<<*pre<< endl;
    b.insert((*nxt) - (l));
    b.insert((l) - (*pre));
    tmp = b.find(len);
    if (tmp != b.end())
        b.erase(tmp);

    //cout << "ok" << endl;

    //it=b.find(l);
    return;
}

void zong(int l) //x,a
{
    it = pre = nxt = x.find(l);
    nxt++, pre--;

    int len = (*nxt) - (*pre);
    //cout << *nxt<<*pre<< endl;
    //  cout << "LEN:" << len << endl;
    a.insert((*nxt) - (l));
    a.insert(((l) - (*pre)));
    tmp = a.find(*nxt - *pre);
    if (tmp != a.end())
        a.erase(tmp);

    return;
}

int main()
{
    ios::sync_with_stdio(false);
    cin >> w >> h >> n;

    char opera;

    a.insert(w);
    b.insert(h);
    //a.insert(0);
    //b.insert(0);

    x.insert(0);
    y.insert(0);
    x.insert(w);
    y.insert(h);
    multiset<int>::iterator t1, t2;

    while (n--)
    {
        cin >> opera;
        cin >> loc;
        //cout << opera << " " << loc << endl;
        //cout<<opera;
        //cout<<loc<<endl;
        if (opera == 'H')
        {
            //cout<<"OK"<<endl;
            //set<int>::iterator it;
            y.insert(loc);
            //cout<<"OK"<<endl;
            heng(loc);
            //cout << "OK" << endl;
            t1 = a.end(), t2 = b.end();
            t1--;
            t2--;
            square = 0;
            square =(ll)(*t1) * (*t2);
            cout << square << endl;
        }
        else
        {
            x.insert(loc);
            zong(loc);
            t1 = a.end(), t2 = b.end();
            t1--;
            t2--;
            square = 0;
            square = (ll)(*t1) * (*t2);
            cout << square << endl;
        }
    }
    return 0;
}


#include<iostream>
#define reg register
#define rep(i,j,k) for(reg int i=j;i<=k;++i)
#define MAXN 200001
#define lson id<<1
#define rson id<<1|1
using namespace std;
int w,h,n;
struct node
{
	int l,r,mx,ls,rs;
	bool flag;
}tree[3][MAXN<<2];
inline int Max(int x,int y,int z)
{
	return x>y?(x>z?x:z):(y>z?y:z);
}
inline void push_up(int id,short k)
{
	tree[k][id].flag=tree[k][lson].flag&&tree[k][rson].flag;
	tree[k][id].mx=Max(tree[k][lson].r+tree[k][rson].l,tree[k][lson].l,tree[k][rson].r);
	tree[k][id].l=tree[k][id].flag?tree[k][lson].mx+tree[k][rson].l:tree[k][lson].l;
	tree[k][id].r=tree[k][id].flag?tree[k][rson].mx+tree[k][lson].r:tree[k][rson].r;
	return;
}
void build(int id,int left,int right,short k)
{
	tree[k][id].ls=left;
	tree[k][id].rs=right;
//	cout<<k<<' '<<id<<' '<<tree[k][id].ls<<' '<<tree[k][id].rs<<'\n';
	if (left==right)
	{
		tree[k][id].mx=1;
		tree[k][id].l=1;
		tree[k][id].r=1;
		tree[k][id].flag=true;
		return;
	}
	int mid=(left+right)>>1;
	build(lson,left,mid,k);
	build(rson,mid+1,right,k);
	push_up(id,k);
	return;
}
void ask(int id,int key,short k)
{
//	cout<<id<<" ####"<<key<<' '<<k<<' '<<(lson)<<' '<<(rson)<<' '<<tree[k][id].ls<<' '<<tree[k][id].rs<<'\n';
	if (tree[k][id].ls==key&&tree[k][id].rs==key)
	{
		tree[k][id].flag=false;
		tree[k][id].mx=0;
		tree[k][id].l=0;
		tree[k][id].r=0;
		return;
	}
	int mid=(tree[k][id].ls+tree[k][id].rs)>>1;
	if (key<=mid) ask(lson,key,k);
	else ask(rson,key,k);
	push_up(id,k);
//	cout<<tree[k][id].l<<' '<<tree[k][id].r<<' '<<tree[k][id].mx<<' '<<tree[k][id].flag<<'\n';
}
int main(void)
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin>>w>>h>>n;
	build(1,1,h-1,1);
	build(1,1,w-1,2);
	rep(i,1,n)
	{
		char ch;
		cin>>ch;
		if (ch=='H')
		{
			int x;
			cin>>x;
			ask(1,x,1);
		}
		if (ch=='V')
		{
			int y;
			cin>>y;
			ask(1,y,2);
		}
		cout<<(tree[1][1].mx+1)*(tree[2][1].mx+1)<<'\n';
	}
	return 0;
}
/*
4 3 4
H 2
V 2
V 3
V 1

8
4
4
2

7 6 5
H 4
V 3
V 5
H 2
V 1

28
16
12
6
4
*/


#include<bits/stdc++.h>
using namespace std;
const int maxl=200005,maxc=200005,maxn=200005;
bool visl[maxl],visc[maxc];
long long ltmp[4*maxc],llft[4*maxc],lrght[4*maxc];
long long ctmp[4*maxl],clft[4*maxl],crght[4*maxl];
void buildl(int k,int l,int r){
	if(l==r){
		ltmp[k]=llft[k]=lrght[k]=1;
		return ;
	}
	int mid=l+((r-l)>>1);
	buildl(2*k,l,mid);
	buildl(2*k+1,mid+1,r);
	ltmp[k]=llft[k]=lrght[k]=r-l+1;
}
void buildc(int k,int l,int r){
	if(l==r){
		ctmp[k]=clft[k]=crght[k]=1;
		return ;
	}
	int mid=l+((r-l)>>1);
	buildc(2*k,l,mid);
	buildc(2*k+1,mid+1,r);
	ctmp[k]=clft[k]=crght[k]=r-l+1;
}
void modifyl(int k,int l,int r,int x){
	if(l>x||r<x)
		return ;
	else if(l==r&&l==x){
		ltmp[k]=llft[k]=lrght[k]=0;
		return ;
	}
	int mid=l+((r-l)>>1);
	modifyl(2*k,l,mid,x);
	modifyl(2*k+1,mid+1,r,x);
	llft[k]=llft[2*k];
	if(llft[2*k]==mid-l+1)
		llft[k]+=llft[2*k+1];
	lrght[k]=lrght[2*k+1];
	if(lrght[2*k+1]==r-mid)
		lrght[k]+=lrght[2*k];
	ltmp[k]=max(ltmp[2*k],ltmp[2*k+1]);
	ltmp[k]=max(ltmp[k],max(llft[k],lrght[k]));
	ltmp[k]=max(ltmp[k],lrght[2*k]+llft[2*k+1]);
}
void modifyc(int k,int l,int r,int x){
	if(l>x||r<x)
		return ;
	else if(l==r&&l==x){
		ctmp[k]=clft[k]=crght[k]=0;
		return ;
	}
	int mid=l+((r-l)>>1);
	modifyc(2*k,l,mid,x);
	modifyc(2*k+1,mid+1,r,x);
	clft[k]=clft[2*k];
	if(clft[2*k]==mid-l+1)
		clft[k]+=clft[2*k+1];
	crght[k]=crght[2*k+1];
	if(crght[2*k+1]==r-mid)
		crght[k]+=crght[2*k];
	ctmp[k]=max(ctmp[2*k],ctmp[2*k+1]);
	ctmp[k]=max(ctmp[k],max(clft[k],crght[k]));
	ctmp[k]=max(ctmp[k],crght[2*k]+clft[2*k+1]);
}
int main()
{
	int c,l,n;
	scanf("%d%d%d",&c,&l,&n);
	buildl(1,0,2*c-1);
	buildc(1,0,2*l-1);
	for(int i=1;i<=n;i++){
		char s;
		int x;
		cin>>s;
		scanf("%d",&x);
		if(s=='H')
			modifyc(1,0,2*l-1,2*(l-x)-1);
		else
			modifyl(1,0,2*c-1,2*x-1);
		long long ans1=ltmp[1],ans2=ctmp[1];
		if(ans1&1)ans1++;ans1/=2;
		if(ans2&1)ans2++;ans2/=2;
		printf("%lld\n",ans1*ans2);
	}
	return 0;
}


#include<iostream>
#include<map>
#include<set>
#include<algorithm>

using namespace std;
/////////////////////////////
multiset<int>S_h;
multiset<int>S_v;
map<int,int>M_h;
map<int,int>M_v;
///////////////////////////////
void cut(int x,map<int,int> &seg,multiset<int> &bst)
{
	map<int,int>::iterator it=seg.lower_bound(x);it--;
	//cout<<0<<endl;
	pair<int,int>S1=make_pair(it->first,x);
	pair<int,int>S2=make_pair(x,it->second);
	//cout<<1<<endl;
	bst.erase(bst.find(it->second-it->first));
	seg.erase(it);
	//cout<<2<<endl;
	seg.insert(S1);
	seg.insert(S2);
	bst.insert(S1.second-S1.first);
	bst.insert(S2.second-S2.first);
}
/////////////////////////////
int print_H()
{
	int x;
	x=*--S_h.end();
	return x;
}
int print_V()
{
	int x;
	x=*--S_v.end();
	return x;
}
////////////////////////////
int main()
{
	int w,h,n;
	cin>>w>>h>>n;
	int i,j;
	S_h.insert(h);
	S_v.insert(w);
	M_h[0]=h;
	M_v[0]=w;
	for(i=1;i<=n;++i)
	{
		char a;
		int b;
		cin>>a>>b;
		if(a=='H')
		{
			cut(b,M_h,S_h);
		}
		else
		{
			cut(b,M_v,S_v);
		}
		cout<<print_H()*print_V()<<endl;
	}
	return 0;
}


#include<bits/stdc++.h>
#define its set<int>::iterator
#define is mulitset<int>::iterator
using namespace std;
int w,h,n;
multiset<int> sx;
multiset<int> sy;
set<int> x;
set<int> y;

inline int read(){
	int x = 0;
	char c = getchar();
	while(!isdigit(c)){
		c = getchar();
	}
	while(isdigit(c)){
		x = x * 10 + c - '0';
		c = getchar();
	}
	return x;
}

int main(){
//	scanf("%d%d%d", &w, &h, &n);
	w = read(), h = read(), n = read();
    x.insert(0);
    x.insert(h);
    y.insert(w);
    y.insert(0);
    sx.insert(h);
    sy.insert(w);
    for(int i = 1;i <= n; i++){
        char c;
        cin >> c;
        int p = read();
		if(c == 'V'){
            y.insert(p);
            its it,itt;
            it = y.lower_bound(p);
            itt = y.upper_bound(p);
            --it;
			int ls,rs;
            ls = p - *it;
            rs = *itt - p;
            int ss = *itt - *it;
            sy.erase(sy.find(ss));
            sy.insert(ls);
            sy.insert(rs);
        }
        else{
            x.insert(p);
            its it,itt;
            it = x.lower_bound(p);
            itt = x.upper_bound(p);
            --it;
			int ls,rs;
            ls = p - *it;
            rs = *itt - p;
            int ss = *itt - *it;
            sx.erase(sx.find(ss));
            sx.insert(rs);
            sx.insert(ls);

        }
        int a,b;
        a = *(--sx.end());
        b = *(--sy.end());
        printf("%lld\n", (1LL)*a*b);
    }

    return 0;
}


#include<iostream>
#define reg register
#define rep(i,j,k) for(reg int i=j;i<=k;++i)
#define MAXN 200001
#define lson id<<1
#define rson id<<1|1
using namespace std;
int w,h,n;
struct node
{
    int l,r,mx,ls,rs;
    bool flag;
}tree[3][MAXN*4];
inline int Max(int x,int y,short z)
{
    return x;//x>y?(x>z?x:z):(y>z?y:z);
}
inline void push_up(int id,short k)
{
    tree[k][id].flag=tree[k][lson].flag&&tree[k][rson].flag;
    tree[k][id].mx=Max(tree[k][lson].r+tree[k][rson].l,tree[k][lson].l,tree[k][rson].r);
    tree[k][id].l=tree[k][id].flag?tree[k][lson].mx+tree[k][rson].l:tree[k][lson].l;
    tree[k][id].r=tree[k][id].flag?tree[k][rson].mx+tree[k][lson].r:tree[k][rson].r;
    return;
}
inline void build(int id,int left,int right,short k)
{
    tree[k][id].ls=left;
    tree[k][id].rs=right;
    if (left==right)
    {
        tree[k][id].mx=1;
        tree[k][id].l=1;
        tree[k][id].r=1;
        tree[k][id].flag=true;
        return;
    }
    int mid=(left+right)<<1;
    build(lson,left,mid,k);
    build(rson,mid+1,right,k);
    push_up(id,k);
    return;
}
inline void ask(int id,int key,int k)
{
    if (tree[k][id].ls==key&&tree[k][id].rs==key)
    {
        tree[k][id].flag=false;
        tree[k][id].mx=0;
        tree[k][id].l=0;
        tree[k][id].r=0;
        return;
    }
    int mid=(tree[k][id].ls+tree[k][id].rs)>>1;
    if (key<=mid) ask(lson,key,k);
    else ask(rson,key,k);
    push_up(id,k);
}
int main(void)
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin>>w>>h>>n;
    build(1,1,w-1,1);
    build(1,1,h-1,2);
    rep(i,1,n)
    {
        char ch;
        cin>>ch;
        if (ch=='H')
        {
            int x;
            cin>>x;
            ask(1,x,1);
        }
        if (ch=='V')
        {
            int y;
            cin>>y;
            ask(1,y,2);
        }
        cout<<(tree[1][1].mx+1)*(tree[2][1].mx+1)<<'\n';
    }
    return 0;
}
/*
4 3 4
H 2
V 2
V 3
V 1

8
4
4
2

7 6 5
H 4
V 3
V 5
H 2
V 1

28
16
12
6
4
*/


#pragma GCC optimize("O2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#include<bits/stdc++.h>
#define int long long
using namespace std;
set<int>la,lb;
multiset<int>a,b;
multiset<int>::iterator it;
main(){
	int x,y,n,t,l,r;
	char c;
	cin>>x>>y>>n;
    a.insert(x),b.insert(y),la.insert(0),la.insert(x),lb.insert(0),lb.insert(y);
    for(int i=1;i<=n;i++){
		cin>>c>>t;
        if(c=='H'){
            lb.insert(t),it=lb.find(t),it--,l=*it,it++,it++,r=*it,it=b.find(r-l),b.erase(it),b.insert(r-t),b.insert(t-l);
        }
        else{
			la.insert(t),it=la.find(t),it--,l=*it,it++,it++,r=*it,it=a.find(r-l),a.erase(it),a.insert(r-t),a.insert(t-l);
        }
        it=a.end(),it--,l=*it,it=b.end();it--,r=*it;
		cout<<l*r<<"\n";
    }
    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define inf 0x3f3f3f3f
#define il inline

namespace io {

    #define in(a) a=read()
    #define out(a) write(a)
    #define outn(a) out(a),putchar('\n')

    #define I_int int
    inline I_int read() {
        I_int x = 0 , f = 1 ; char c = getchar() ;
        while( c < '0' || c > '9' ) { if( c == '-' ) f = -1 ; c = getchar() ; }
        while( c >= '0' && c <= '9' ) { x = x * 10 + c - '0' ; c = getchar() ; }
        return x * f ;
    }
    char F[ 200 ] ;
    inline void write( I_int x ) {
        if( x == 0 ) { putchar( '0' ) ; return ; }
        I_int tmp = x > 0 ? x : -x ;
        if( x < 0 ) putchar( '-' ) ;
        int cnt = 0 ;
        while( tmp > 0 ) {
            F[ cnt ++ ] = tmp % 10 + '0' ;
            tmp /= 10 ;
        }
        while( cnt > 0 ) putchar( F[ -- cnt ] ) ;
    }
    #undef I_int

}
using namespace io ;

using namespace std ;

#define N 1000100

int n = read(), m = read(), k = read();
struct tree {
	int l, r;
	int mx, lm, rm, len;
} t[N<<2][2];

#define lc (rt << 1)
#define rc (rt << 1 | 1)
#define mid ((l + r) >> 1)

void pushup(int rt, int c) {
	t[rt][c].lm = t[lc][c].lm;
	if(t[lc][c].lm == t[lc][c].len) t[rt][c].lm += t[rc][c].lm;
	t[rt][c].rm = t[rc][c].rm;
	if(t[rc][c].rm == t[rc][c].len) t[rt][c].rm += t[lc][c].rm;
	t[rt][c].mx = max(t[rt][c].lm, t[rt][c].rm);
	t[rt][c].mx = max(t[rt][c].mx, t[lc][c].rm + t[rc][c].lm);
}

void build(int l, int r, int rt, int c) {
	t[rt][c].l = l; t[rt][c].r = r;
	t[rt][c].len = t[rt][c].mx = t[rt][c].lm = t[rt][c].rm = r - l + 1;
	if(l == r) return;
	build(l, mid, lc, c); build(mid + 1, r, rc, c);
	pushup(rt, c);
}

#define l (t[rt][c].l)
#define r (t[rt][c].r)
void upd(int pos, int rt, int c) {
	if(pos == l && pos == r) {
		t[rt][c].lm = t[rt][c].rm = t[rt][c].mx = 0;
		return;
	}
	if(pos <= mid) upd(pos, lc, c);
	else upd(pos, rc, c);
	pushup(rt, c);
}

#undef lc
#undef rc
#undef mid
#undef l
#undef r

int main() {
	build(1, n - 1, 1, 0); build(1, m - 1, 1, 1);
	for(int i = 1; i <= k; ++i) {
		char ch[20];
		scanf("%s", ch);
		int x = read();
		if(ch[0] == 'V') upd(x, 1, 0);
		else upd(x, 1, 1);
		printf("%lld\n", 1ll * (t[1][0].mx + 1) * (t[1][1].mx + 1));
	}
}


#include<bits/stdc++.h>
#define its set<int>::iterator
#define is mulitset<int>::iterator

using namespace std;
int w,h,n;
multiset<int> sx;
multiset<int> sy;
set<int> x;
set<int> y;
int main(){

	scanf("%d%d%d",&w,&h,&n);
	x.insert(0);
	x.insert(h);
	y.insert(w);
	y.insert(0);
	sx.insert(h);
	sy.insert(w);
	for(int i=1;i<=n;++i)
	{
		char c;
		int p;
		cin>>c;
		scanf("%d",&p);

		if(c=='V')
		{
			y.insert(p);
			its it,itt;
			it=y.lower_bound(p);
			itt=y.upper_bound(p);
			--it;

			int ls,rs;
			ls=p-*it;
			rs=*itt-p;
			int ss=*itt-*it;
			//cout<<*itt<<" "<<*it<<" "<<ss<<endl;
			sy.erase(sy.find(ss));
			sy.insert(ls);
			sy.insert(rs);
		}
		else
		{
			x.insert(p);
			its it,itt;
			it=x.lower_bound(p);
			itt=x.upper_bound(p);
			--it;

			int ls,rs;
			ls=p-*it;
			rs=*itt-p;
			int ss=*itt-*it;
			//cout<<*itt<<" "<<*it<<" "<<ss<<endl;
			sx.erase(sx.find(ss));
			sx.insert(rs);
			sx.insert(ls);

		}
		int a,b;
		a=*(--sx.end());
		b=*(--sy.end());
		printf("%lld\n",(1LL)*a*b);
	}

	return 0;
}


#include<iostream>
#include<map>
#include<cstdio>
#include<algorithm>
#include<set>
using namespace std;

int main()
{
	set<int> xx;
	set<int> yy;
	multiset<int> xdis;
	multiset<int> ydis;
	int x,y,n;
	long long ans;
	cin>>x>>y>>n;
	xx.insert(0);
	xx.insert(x);
	yy.insert(0);
	yy.insert(y);
	xdis.insert(x);
	ydis.insert(y);
	while(n--)
	{
		string act;
		cin>>act;
		int where;
		cin>>where;
		if(act=="H")
		{
			yy.insert(where);
			int distance=*(yy.upper_bound(where))-*(--yy.lower_bound(where));
			ydis.erase(ydis.lower_bound(distance));
			ydis.insert(where-*(--yy.lower_bound(where)));
			ydis.insert(*yy.upper_bound(where)-where);
		}
		if(act=="V")
		{
			xx.insert(where);
			int distance=*(xx.upper_bound(where))-*(--xx.lower_bound(where));
			xdis.erase(xdis.lower_bound(distance));
			xdis.insert(where-*(--xx.lower_bound(where)));
			xdis.insert(*xx.upper_bound(where)-where);
		}
		cout<<(long long)*(--ydis.end())**(--xdis.end())<<endl;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
multiset<int>x;multiset<int>y;
multiset<int>qx;multiset<int>qy;
int main()
{
	int w,h,m,a,l,r;
	char op;
	scanf("%d%d%d",&w,&h,&m);
	x.insert(0);y.insert(0);
	x.insert(w);y.insert(h);
	qx.insert(w);qy.insert(h);
	multiset<int>::iterator it;
	multiset<int>::iterator ix;
	multiset<int>::iterator iy;
	while(m--)
	{
		cin>>op>>a;
		if(op=='H')//y
		{
			r=*y.upper_bound(a);
			it=y.lower_bound(a);
			it--;
			y.insert(a);
			qy.erase(qy.find(r-*it));
			qy.insert(r-a);
			qy.insert(a-*it);
		}
		else
		{
			r=*x.upper_bound(a);
			it=x.lower_bound(a);
			it--;
			x.insert(a);
			qx.erase(qx.find(r-*it));
			qx.insert(r-a);
			qx.insert(a-*it);
		}
		ix=qx.end();
		iy=qy.end();
		ix--;
		iy--;
		printf("%d\n",(*iy)*(*ix));
	}
}


#include <bits/stdc++.h>

#define ll long long
#define inf 0x3f3f3f3f
#define il inline

namespace io {

    #define in(a) a=read()
    #define out(a) write(a)
    #define outn(a) out(a),putchar('\n')

    #define I_int int
    inline I_int read() {
        I_int x = 0 , f = 1 ; char c = getchar() ;
        while( c < '0' || c > '9' ) { if( c == '-' ) f = -1 ; c = getchar() ; }
        while( c >= '0' && c <= '9' ) { x = x * 10 + c - '0' ; c = getchar() ; }
        return x * f ;
    }
    char F[ 200 ] ;
    inline void write( I_int x ) {
        if( x == 0 ) { putchar( '0' ) ; return ; }
        I_int tmp = x > 0 ? x : -x ;
        if( x < 0 ) putchar( '-' ) ;
        int cnt = 0 ;
        while( tmp > 0 ) {
            F[ cnt ++ ] = tmp % 10 + '0' ;
            tmp /= 10 ;
        }
        while( cnt > 0 ) putchar( F[ -- cnt ] ) ;
    }
    #undef I_int

}
using namespace io ;

using namespace std ;

#define N 1000100

int n, m, k;
struct tree {
	int l, r;
	int mx, lm, rm, len;
} t[N<<2][2];

#define lc (rt << 1)
#define rc (rt << 1 | 1)

void pushup(int rt, int c) {
	if(t[lc][c].mx == t[lc][c].len) t[rt][c].lm = t[lc][c].mx + t[rc][c].lm;
	else t[rt][c].lm = t[lc][c].lm;
	if(t[rc][c].mx == t[rc][c].len) t[rt][c].rm = t[rc][c].mx + t[lc][c].rm;
	else t[rt][c].rm = t[rc][c].rm;
	t[rt][c].mx = max(t[lc][c].mx, t[rc][c].mx);
	t[rt][c].mx = max(t[rt][c].mx, t[lc][c].rm + t[rc][c].lm);
}

void build(int l, int r, int rt, int c) {
	t[rt][c].l = l; t[rt][c].r = r;
	t[rt][c].len = t[rt][c].mx = t[rt][c].lm = t[rt][c].rm = r - l + 1;
	int mid = (l + r) >> 1; if(l == r) return;
	build(l, mid, lc, c); build(mid + 1, r, rc, c);
}

#define l (t[rt][c].l)
#define r (t[rt][c].r)
void upd(int pos, int rt, int c) {
	if(pos == l && pos == r) {
		t[rt][c].lm = t[rt][c].rm = t[rt][c].mx = 0;
		return;
	}
	int mid = (l + r) >> 1;
	if(pos <= mid) upd(pos, lc, c);
	else upd(pos, rc, c);
	pushup(rt, c);
}

#undef lc
#undef rc
#undef l
#undef r

int main() {
//freopen("D.in", "r", stdin);
//freopen("D.out", "w", stdout);
	n = read(); m = read(); k = read();
	build(1, n - 1, 1, 0); build(1, m - 1, 1, 1);
	for(int i = 1; i <= k; ++i) {
		char ch[20]; int x;
		scanf("%s%d", ch, &x);
	//	int x = read();
		if(ch[0] == 'H') upd(x, 1, 1);
		else upd(x, 1, 0);
		ll ans = 1ll * (t[1][0].mx + 1) * (t[1][1].mx + 1);
		printf("%lld\n", ans);
	}
}


#include<bits/stdc++.h>
using namespace std;
const int maxn=200010;
#define ll long long
int n1,n2,m,x;
char op[2];
struct node{
    int lsum,rsum,sum;
}tree1[maxn<<2],tree2[maxn<<2];
void build(node tree[],int p,int l,int r){
    tree[p].lsum=tree[p].rsum=tree[p].sum=r-l+1;
    if(l==r) return;
    int mid=l+r>>1;
    build(tree,p<<1,l,mid);
	build(tree,p<<1|1,mid+1,r);
}
void pushup(node tree[],int p,int l,int r){
    int mid=l+r>>1;
    tree[p].sum=max(tree[p<<1].sum,tree[p<<1|1].sum);
    tree[p].sum=max(tree[p].sum,tree[p<<1].rsum+tree[p<<1|1].lsum);
    tree[p].lsum=tree[p<<1].lsum;
	if(tree[p<<1].sum==mid-l+1) tree[p].lsum+=tree[p<<1|1].lsum;
    tree[p].rsum=tree[p<<1|1].rsum;
	if(tree[p<<1|1].sum==r-mid) tree[p].rsum+=tree[p<<1].rsum;
}
void update(node tree[],int p,int l,int r,int x){
    if(l==r){
        tree[p].lsum=tree[p].rsum=tree[p].sum=0;return;
    }
    int mid=l+r>>1;
    if(x<=mid) update(tree,p<<1,l,mid,x);
    else update(tree,p<<1|1,mid+1,r,x);
    pushup(tree,p,l,r);
}
int main(){
	scanf("%d%d%d",&n1,&n2,&m);
    build(tree1,1,1,n1-1);
	build(tree2,1,1,n2-1);
    while(m--){
        scanf("%s%d",op,&x);
        if(op[0]=='V') update(tree1,1,1,n1-1,x);
        else update(tree2,1,1,n2-1,x);
        printf("%lld\n",(ll)(tree1[1].sum+1)*(tree2[1].sum+1));
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int maxn=200010;
set<int>H,V;
int mh[maxn],mv[maxn];
void cut(set<int>&s,int *a,int val){
    s.insert(val);
    set<int>::iterator l,r;
    l=r=s.find(val);
    l--;
	r++;
    a[*r-*l]--;
    a[*r-val]++;
    a[val-*l]++;
}
int main(){
	int n,h,v,x,maxh,maxv;
    scanf("%d %d %d",&v,&h,&n);
    mh[h]=1;
	mv[v]=1;
    H.insert(h);
	V.insert(v);
    H.insert(0);
	V.insert(0);
    maxh=h;
	maxv=v;
    char ch;
    while(n--){
    	cin >> ch;
        scanf("%d",&x);
        ch=='H'?cut(H,mh,x):cut(V,mv,x);
        while(!mh[maxh]) maxh--;
        while(!mv[maxv]) maxv--;
        long long ans=(long long)(maxh*maxv);
        printf("%lld\n",ans);
    }
    return 0;
}


#include<iostream>
#include<map>
#include<set>
#include<algorithm>
using namespace std;
/////////////////////////////
multiset<int>S_h;
multiset<int>S_v;
map<int,int>M_h;
map<int,int>M_v;
///////////////////////////////
void cut(int x,map<int,int> &seg,multiset<int> &bst)
{
	map<int,int>::iterator it=seg.lower_bound(x);it--;
	//cout<<0<<endl;
	pair<int,int>S1=make_pair(it->first,x);
	pair<int,int>S2=make_pair(x,it->second);
	//cout<<1<<endl;
	bst.erase(bst.find(it->second-it->first));
	seg.erase(it);
	//cout<<2<<endl;
	seg.insert(S1);
	seg.insert(S2);
	bst.insert(S1.second-S1.first);
	bst.insert(S2.second-S2.first);
}
/////////////////////////////
long long print_H()
{
	long long x;
	x=*--S_h.end();
	return x;
}
long long print_V()
{
	long long x;
	x=*--S_v.end();
	return x;
}
////////////////////////////
int main()
{
	int w,h,n;
	cin>>w>>h>>n;
	int i,j;
	S_h.insert(h);
	S_v.insert(w);
	M_h[0]=h;
	M_v[0]=w;
	for(i=1;i<=n;++i)
	{
		char a;
		int b;
		cin>>a>>b;
		if(a=='H')
		{
			cut(b,M_h,S_h);
		}
		else
		{
			cut(b,M_v,S_v);
		}
		cout<<print_H()*print_V()<<endl;
	}
	return 0;
}


#include<cstdio>
#include<iostream>
#include<algorithm>
#define ll long long
using namespace std;
const int N=2e5+5;

int w,h,n;

int a1[N],a2[N];

pair<int,int>p1[N],p2[N];

ll ans[N];

struct dat1{
	int id,x;
}s[N];

int main(){

	cin>>w>>h>>n;

	int now;

	for(int i=1;i<=n;++i){
		char c=getchar();
		while(c!='H'&&c!='V')
			c=getchar();

		scanf("%d",&now);

		s[i].x=now;

		switch(c){
			case 'H':
				a2[now]=1;
				s[i].id=2;
				break;
			case 'V':
				a1[now]=1;
				s[i].id=1;
				break;
		}
	}

	int last=0,maxh=1,maxw=1;

	for(int i=1;i<=w;++i)
		if(a1[i]||i==w){
			p1[i].first=last;
			p1[last].second=i;
			maxw=max(maxw,i-last);
			last=i;
		}

	last=0;

	for(int i=1;i<=h;++i)
		if(a2[i]||i==h){
			p2[i].first=last;
			p2[last].second=i;
			maxh=max(maxh,i-last);
			last=i;
		}

	for(int i=n;i;--i){
//		cout<<(ll)maxh*maxw<<endl;
		ans[i]=(ll)maxh*maxw;
		int x=s[i].x;
		if(s[i].id==1){
			int pre=p1[x].first;
			int nex=p1[x].second;
			maxw=max(maxw,nex-pre);
			p1[pre].second=nex;
			p1[nex].first=pre;
		}

		else{
			int pre=p2[x].first;
			int nex=p2[x].second;
			maxh=max(maxh,nex-pre);
			p2[pre].second=nex;
			p2[nex].first=pre;
		}
	}

	for(int i=1;i<=n;++i)
		printf("%lld\n",ans[i]);

	return 0;
}


#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int N,w,h;
struct pointff{
	int val;
	int lval,rval;
	bool ling;
}ctr[1000050],ktr[1000050];
int maxx(int x,int y,int z)
{
	int zc=0;
	if(x>y)
		zc=x;
	else
		zc=y;
	if(zc<z)
		zc=z;
	return zc;
}

void Pushup(int rt)
{
	if(ctr[rt<<1].ling &&ctr[rt<<1|1].ling )
	{
		ctr[rt].val=ctr[rt<<1].val +ctr[rt<<1|1].val;
		ctr[rt].ling =true;
		ctr[rt].lval =ctr[rt].val ;
		ctr[rt].rval =ctr[rt].val ;
		return;
	}
	if(ctr[rt<<1].ling )
	{
		ctr[rt].val=maxx(ctr[rt<<1].val +ctr[rt<<1|1].lval ,ctr[rt<<1|1].val ,ctr[rt<<1|1].rval );
		ctr[rt].ling =false;
		ctr[rt].lval=ctr[rt].val ;
		ctr[rt].rval =ctr[rt<<1|1].rval ;
		return;
	}
	if(ctr[rt<<1|1].ling )
	{
		ctr[rt].val=maxx(ctr[rt<<1|1].val +ctr[rt<<1].rval ,ctr[rt<<1].val ,ctr[rt<<1].lval );
		ctr[rt].ling =false;
		ctr[rt].lval=ctr[rt<<1].lval;
		ctr[rt].rval=ctr[rt].val ;
		return;
	}
	ctr[rt].ling =false;
	int zc=ctr[rt<<1].rval+ctr[rt<<1|1].lval ;
	ctr[rt].val =maxx(zc,ctr[rt<<1].val ,ctr[rt<<1|1].val );
	ctr[rt].lval =ctr[rt<<1].lval ;
	ctr[rt].rval =ctr[rt<<1|1].rval;
}
void Pushupk(int rt)
{
	if(ktr[rt<<1].ling &&ktr[rt<<1|1].ling )
	{
		ktr[rt].val=ktr[rt<<1].val +ktr[rt<<1|1].val;
		ktr[rt].ling =true;
		ktr[rt].lval =ktr[rt].val ;
		ktr[rt].rval =ktr[rt].val ;
		return;
	}
	if(ktr[rt<<1].ling )
	{
		ktr[rt].val=maxx(ktr[rt<<1].val +ktr[rt<<1|1].lval ,ktr[rt<<1|1].val ,ktr[rt<<1|1].rval );
		ktr[rt].ling =false;
		ktr[rt].lval=ktr[rt].val ;
		ktr[rt].rval =ktr[rt<<1|1].rval ;
		return;
	}
	if(ktr[rt<<1|1].ling )
	{
		ktr[rt].val=maxx(ktr[rt<<1|1].val +ktr[rt<<1].rval ,ktr[rt<<1].val ,ktr[rt<<1].lval );
		ktr[rt].ling =false;
		ktr[rt].lval=ktr[rt<<1].lval;
		ktr[rt].rval=ktr[rt].val ;
		return;
	}
	ktr[rt].ling =false;
	int zc=ktr[rt<<1].rval+ktr[rt<<1|1].lval ;
	ktr[rt].val =maxx(zc,ktr[rt<<1].val ,ktr[rt<<1|1].val );
	ktr[rt].lval =ktr[rt<<1].lval ;
	ktr[rt].rval =ktr[rt<<1|1].rval;
}
void Updatec(int l,int r,int num,int rt){
	if(l==r  &&  l==num){
		ctr[rt].lval =0;
		ctr[rt].rval =0;
		ctr[rt].val =0;
		ctr[rt].ling =0;
		return;
	}
	int m=(l+r)>>1;
	if(m>=num) Updatec(l,m,num,rt<<1);
	if(m+1<=num) Updatec(m+1,r,num,rt<<1|1);
	Pushup(rt);
}
void Updatek(int l,int r,int num,int rt)
{
	if(l==r  &&  l==num){
		ktr[rt].lval =0;
		ktr[rt].rval =0;
		ktr[rt].val =0;
		ktr[rt].ling =0;
		return;
	}
	int m=(l+r)>>1;
	if(m>=num) Updatek(l,m,num,rt<<1);
	if(m+1<=num) Updatek(m+1,r,num,rt<<1|1);
	Pushupk(rt);
}
void Buildk(int l,int r,int rt)
{
	if(l==r&&(l==1||l==h+1)){
		ktr[rt].lval =0;
		ktr[rt].rval =0;
		ktr[rt].val =0;
		ktr[rt].ling =0;
		return;
	}
	if(l==r)
	{
		ktr[rt].ling =1;
		ktr[rt].lval =1;
		ktr[rt].rval =1;
		ktr[rt].val =1;
		return;
	}
	int m=(l+r)>>1;
	Buildk(l,m,rt<<1);
	Buildk(m+1,r,rt<<1|1);
	Pushupk(rt);
}
void Buildc(int l,int r,int rt)
{
	if(l==r&& (l==1||l==w+1)){
		ctr[rt].lval =0;
		ctr[rt].rval =0;
		ctr[rt].val =0;
		ctr[rt].ling =0;
		return;
	}
	if(l==r)
	{
		ctr[rt].ling =1;
		ctr[rt].lval =1;
		ctr[rt].rval =1;
		ctr[rt].val =1;
		return;
	}

	int m=(l+r)>>1;
	Buildc(l,m,rt<<1);
	Buildc(m+1,r,rt<<1|1);
	Pushup(rt);
//	cout<<l<<r<<rt<<ctr[rt].val<<endl;
	}
void Push(){

	char x;
	scanf("%c",&x);
	scanf("%c",&x);
	if(x=='V'){
		int y;
		scanf("%d",&y);
		Updatec(1,w+1,y+1,1);
	}
	else{
		int y;
		scanf("%d",&y);
		Updatek(1,h+1,y+1,1);
	}
/*	for(int i=1;i<=30;i++)
		cout<<ctr[i].val <<" ";
*/
	cout<<(ktr[1].val+1)*(ctr[1].val+1)<<endl;
}
int main()
{
	cin>>w>>h>>N;
	Buildc(1,w+1,1);
	Buildk(1,h+1,1);

	for(int i=1;i<=N;i++)
	Push();
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
multiset<int>x;multiset<int>y;
multiset<int>qx;multiset<int>qy;
signed main()
{
	int w,h,m,a,l,r;
	char op;
	scanf("%lld%lld%lld",&w,&h,&m);
	x.insert(0);y.insert(0);
	x.insert(w);y.insert(h);
	qx.insert(w);qy.insert(h);
	multiset<int>::iterator it;
	multiset<int>::iterator ix;
	multiset<int>::iterator iy;
	while(m--)
	{
		cin>>op>>a;
		if(op=='H')//y
		{
			r=*y.upper_bound(a);
			it=y.lower_bound(a);
			it--;
			y.insert(a);
			qy.erase(qy.find(r-*it));
			qy.insert(r-a);
			qy.insert(a-*it);
		}
		else
		{
			r=*x.upper_bound(a);
			it=x.lower_bound(a);
			it--;
			x.insert(a);
			qx.erase(qx.find(r-*it));
			qx.insert(r-a);
			qx.insert(a-*it);
		}
		ix=qx.end();
		iy=qy.end();
		ix--;
		iy--;
		printf("%lld\n",(*iy)*(*ix));
	}
}


#include<bits/stdc++.h>
using namespace std;
#define MAXN 1000010
#define int long long
int sum_z[MAXN][5];
int sum_y[MAXN][5];
int sum_m[MAXN][5];
bool ifallzero[MAXN][5];
void update(int now,int horz)
{
	if(ifallzero[now<<1][horz]==1)//左儿子全零
		sum_z[now][horz]=sum_z[now<<1][horz]+sum_z[now<<1|1][horz];//当前左边等于左边的全部+右边的左边
	else
		sum_z[now][horz]=sum_z[now<<1][horz];//否则当前左边等于左儿子左边

	if(ifallzero[now<<1|1][horz]==1)//右儿子全零
		sum_y[now][horz]=sum_y[now<<1|1][horz]+sum_y[now<<1][horz];//同上
	else
		sum_y[now][horz]=sum_y[now<<1|1][horz];//同上

	sum_m[now][horz]=max((sum_y[now<<1][horz]+sum_z[now<<1|1][horz]),max(sum_m[now<<1][horz],sum_m[now<<1|1][horz]));//中间等于左边的右边+右边的左边与左右两边最大值的最大值

	if(ifallzero[now<<1][horz]==1&&ifallzero[now<<1|1][horz]==1)
	ifallzero[now][horz]=true;//左右全零和全零
}
void build(int now,int l,int r,int horz)
{
	if(l==r)
	{
		sum_z[now][horz]=1;
		sum_y[now][horz]=1;
		sum_m[now][horz]=1;
		ifallzero[now][horz]=true;
		return ;
	}
	int mid=(l+r)>>1;
	build(now<<1,l,mid,horz);
	build(now<<1|1,mid+1,r,horz);
	update(now,horz);
}
void change(int now,int l,int r,int go,int horz)
{
	if(l==r)
	{
		ifallzero[now][horz]=false;
		sum_z[now][horz]=0;
		sum_y[now][horz]=0;
		sum_m[now][horz]=0;
		return ;
	}
	int mid=(l+r)>>1;
	if(go<=mid)
	change(now<<1,l,mid,go,horz);
	else
	change(now<<1|1,mid+1,r,go,horz);
	update(now,horz);
}
signed main()
{
	int w,h,n,x;
	char o;
	cin>>w>>h>>n;
	build(1,1,w-1,1);//横
	build(1,1,h-1,2);//纵
	for(int i=1;i<=n;i++)
	{
		cin>>o>>x;
		if(o=='H')
			change(1,1,h-1,x,2);//横切影响纵
		if(o=='V')
			change(1,1,w-1,x,1);//纵切影响横
		cout<<(sum_m[1][1]+1)*(sum_m[1][2]+1)<<endl;
	}
}


#include<bits/stdc++.h>
using namespace std;
const int maxn=200010;
set<int>H,V;
int mh[maxn],mv[maxn];
void cut(set<int>&s,int *a,int val){
    s.insert(val);
    set<int>::iterator l,r;
    l=r=s.find(val);
    l--;
	r++;
    a[*r-*l]--;
    a[*r-val]++;
    a[val-*l]++;
}
int main(){
	int n,h,v,x,maxh,maxv;
    scanf("%d %d %d",&v,&h,&n);
    mh[h]=1;
	mv[v]=1;
    H.insert(h);
	V.insert(v);
    H.insert(0);
	V.insert(0);
    maxh=h;
	maxv=v;
    char ch;
    while(n--){
    	cin >> ch;
        scanf("%d",&x);
        ch=='H'?cut(H,mh,x):cut(V,mv,x);
        while(!mh[maxh]) maxh--;
        while(!mv[maxv]) maxv--;
        long long ans=maxh*maxv;
        printf("%lld\n",ans);
    }
    return 0;
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
set<int>la,lb;
multiset<int>a,b;
multiset<int>::iterator it;
main(){
	int x,y,n,t,l,r;
	char c;
    scanf("%lld%lld%lld",&x,&y,&n);
    a.insert(x),b.insert(y),la.insert(0),la.insert(x),lb.insert(0),lb.insert(y);
    for(int i=1;i<=n;i++){
		cin>>c,scanf("%lld",&t);
        if(c=='H'){
            lb.insert(t),it=lb.find(t),it--,l=*it,it++,it++,r=*it,it=b.find(r-l),b.erase(it),b.insert(r-t),b.insert(t-l);
        }
        else{
			la.insert(t),it=la.find(t),it--,l=*it,it++,it++,r=*it,it=a.find(r-l),a.erase(it),a.insert(r-t),a.insert(t-l);
        }
        it=a.end(),it--,l=*it,it=b.end();it--,r=*it;
		printf("%lld\n",l*r);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <set>
using namespace std;
inline int gi() {
    register int data = 0, w = 1;
    register char ch = 0;
    while (!isdigit(ch) && ch != '-') ch = getchar();
    if (ch == '-') w = -1, ch = getchar();
    while (isdigit(ch)) data = 10 * data + ch - '0', ch = getchar();
    return w * data;
}
typedef long long ll;
int W, H, N;
set<ll> cx, cy;
multiset<ll> x, y;
multiset<ll> :: iterator ite;

int main() {
    W = gi(), H = gi(), N = gi();
    x.insert(W), y.insert(H);
    cx.insert(0), cx.insert(W);
    cy.insert(0), cy.insert(H);
    for (int i = 1; i <= N; i++) {
        char ch[5]; scanf("%s", ch);
        int t = gi();
        if (ch[0] == 'H') {
            cy.insert(t); ite = cy.find(t); --ite;
            ll l = *ite; ++ite; ++ite;
            ll r = *ite;
            ite = y.find(r - l);
            y.erase(ite); y.insert(r - t); y.insert(t - l);
        }
        else {
            cx.insert(t); ite = cx.find(t); --ite;
            ll l = *ite; ++ite; ++ite;
            ll r = *ite;
            ite = x.find(r - l);
            x.erase(ite); x.insert(r - t); x.insert(t - l);
        }
        ite = x.end(); --ite;
        ll l = *ite;
        ite = y.end(); --ite;
        printf("%I64d\n", l * (*ite));
    }
    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <algorithm>
using namespace std;
#define lson id<<1
#define rson id<<1|1
const long long maxn=800010;
long long x,w,h,n,a[maxn],b[maxn];
char c;
long long lef[maxn][2],righ[maxn][2],l[maxn][2],r[maxn][2],ma[maxn][2];
bool pure[maxn][2];
void pushup(long long id,long long k){
    pure[id][k]=pure[lson][k]&&pure[rson][k];
    ma[id][k]=max(r[lson][k]+l[rson][k],max(ma[lson][k],ma[rson][k]));
    l[id][k]=pure[lson][k]?l[lson][k]+l[rson][k]:l[lson][k];
    r[id][k]=pure[rson][k]?r[rson][k]+r[lson][k]:r[rson][k];
}
inline void build(long long id,long long ll,long long rr,long long k)
{
    lef[id][k]=ll;righ[id][k]=rr;
    if (ll==rr){pure[id][k]=true;ma[id][k]=1;l[id][k]=1;r[id][k]=1;return;}
    long long mid=(ll+rr)>>1;
    build(lson,ll,mid,k);build(rson,mid+1,rr,k);
    pushup(id,k);
}
inline void update(long long id,long long x,long long k){
    if (lef[id][k]==x && righ[id][k]==x){pure[id][k]=false;ma[id][k]=0;l[id][k]=0;r[id][k]=0;return;}
    long long mid=(lef[id][k]+righ[id][k])>>1;
    if (x<=mid) update(lson,x,k);
    	   else update(rson,x,k);
    pushup(id,k);
}
int main(){
    scanf("%lld%lld%lld",&w,&h,&n);
    build(1,1,w-1,1);build(1,1,h-1,0);
    for (long long i=1;i<=n;i++)
    {
        c=getchar();
        while (c!='H' && c!='V') c=getchar();
        if (c=='V') {scanf("%lld",&x);update(1,x,1);}
        else {scanf("%lld",&x);update(1,x,0);}
        printf("%lld\n",(ma[1][1]+1)*(ma[1][0]+1));
    }
    return 0;
}


#include<iostream>
#include<sstream>
#include<fstream>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cctype>
#include<cmath>
#include<ctime>
#include<iomanip>
#include<complex>
#define re register
#define pi acos(-1.0)
#define inf 2147483640
using namespace std;
inline int read()
{
    int sum=0,negative=1;
    char ch=getchar();
    while(ch<'0'||ch>'9')
    {
        if(ch=='-')negative=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9')
    {
        sum=sum*10+ch-'0';
        ch=getchar();
    }
    return sum*negative;
}
inline void write(long long X)
{
    if(X<0)putchar('-'),X=-X;
    if(X>=10)write(X/10);
    putchar(X%10+'0');
}
const int maxn=200001;
int l[maxn<<2][2],r[maxn<<2][2],Max[maxn<<2][2],M[2];
bool flag[maxn<<2][2];
void push_up(int s,int k){
	flag[s][k]=flag[s<<1][k]&&flag[s<<1|1][k];
	Max[s][k]=max(r[s<<1][k]+l[s<<1|1][k],max(Max[s<<1][k],Max[s<<1|1][k]));
	l[s][k]=flag[s<<1][k]?l[s<<1][k]+l[s<<1|1][k]:l[s<<1][k];
	r[s][k]=flag[s<<1|1][k]?r[s<<1|1][k]+r[s<<1][k]:r[s<<1|1][k];
}
void change(int x,int k){
	re int s=M[k]+x-1;
	flag[s][k]=Max[s][k]=r[s][k]=l[s][k]=0;
	for(s>>=1;s;s>>=1){
		push_up(s,k);
	}
}
void build(int n,int k){
	for(re int i=0;i<M[k];i++){
		l[M[k]+i][k]=r[M[k]+i][k]=Max[M[k]+i][k]=flag[M[k]+i][k]=i<n;
	}
	for(re int i=M[k]-1;i>=0;i--){
		push_up(i,k);
	}
}
int main()
{
	int w,h,n;
	while(scanf("%d%d%d",&w,&h,&n)!=EOF){
		M[0]=M[1]=1;
		while(M[0]<h-1){
			M[0]<<=1;
		}
		while(M[1]<w-1){
			M[1]<<=1;
		}
		build(h-1,0);
		build(w-1,1);
		for(re int i=0;i<n;i++){
			char x;
			int v;
			cin>>x;
			v=read();
			if(x=='H'){
				change(v,0);
			}
			else{
				change(v,1);
			}
			printf("%lld\n",(long long)(Max[1][0]+1)*(Max[1][1]+1));
		}
	}
    return 0;
}


#include <iostream>
#include <cstdio>
using namespace std;
int x,y,z,k;char ch[3];
struct node{
	int s/*区间最长连续0*/,ls/*zuo qi 最长连续0*/,rs/*you qi 最长连续0*/,l/*区间左端点=pl*/,r/*区间右端点=pr*/;
	bool t/*区间是否全0*/;
}f[2][200005<<2];
inline void update(int rt,node f[]){
	int ans=max(f[rt<<1].s, f[rt<<1|1].s);
	ans=max(ans, f[rt<<1].rs+f[rt<<1|1].ls);
	f[rt].s=ans;
	if(f[rt<<1].t) f[rt].ls=f[rt<<1].s+f[rt<<1|1].ls;
	else f[rt].ls=f[rt<<1].ls;
	if(f[rt<<1|1].t) f[rt].rs=f[rt<<1|1].s+f[rt<<1].rs;
	else f[rt].rs=f[rt<<1|1].rs;
	f[rt].t=f[rt<<1].t&&f[rt<<1|1].t;
}
inline void build(int l,int r,int rt,node f[]){
	if(l==r){
		f[rt].s=1;
		f[rt].ls=1;
		f[rt].rs=1;
		f[rt].t=true;
		f[rt].l=l;
		f[rt].r=r;
		return;
	}
	int m=(l+r)>>1;
	f[rt].l=l;
	f[rt].r=r;
	build(l, m, rt<<1, f);
	build(m+1, r, rt<<1|1, f);
	update(rt,f);/*更新这个array*/
}
inline void change(int x,int rt,node f[]){
	int nx=f[rt].l,ny=f[rt].r;
	if(nx==ny){
		f[rt].s=0;
		f[rt].ls=0;
		f[rt].rs=0;
		f[rt].t=false;
		return;
	}
	int m=(nx+ny)>>1;
	if(x<=m) change(x, rt<<1, f);
	else change(x,rt<<1|1,f);
	update(rt,f);/*更新这个array*/
}
int main(){
	scanf("%d%d%d",&x,&y,&z);
	build(1,x-1,1,f[0]);
	build(1,y-1,1,f[1]);
	for(int i=0;i<z;i++){
		scanf("%s",ch);
		if(ch[0]=='H'){
			scanf("%d",&k);
			change(k,1,f[1]);
			printf("%d\n",(f[0][1].s+1)*(f[1][1].s+1));
		}
		else {
			scanf("%d",&k);
			change(k,1,f[0]);
			printf("%d\n",(f[0][1].s+1)*(f[1][1].s+1));
		}
	}
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
set <int> H;
set <int> V;
multiset <int> Hs;
multiset <int> Vs;
int w,h,n;
main(){
    cin>>w>>h>>n;
    Hs.insert(h);
    Vs.insert(w);
    H.insert(0);
    H.insert(h);
    V.insert(0);
    V.insert(w);
    for(int i=1;i<=n;i++){
        char c;
        int x;
        cin>>c>>x;
        if(c=='H'){
            set<int>::iterator it=H.lower_bound(x);
            int l,r=*it;
            it--;
            l=*it;
            Hs.erase(Hs.find(r-l));
            Hs.insert(x-l);
            Hs.insert(r-x);
            H.insert(x);
            cout<<(*Hs.rbegin())*(*Vs.rbegin())<<endl;
        }
        else{
            set<int>::iterator it=V.lower_bound(x);
            int l,r=*it;
            it--;
            l=*it;
            Vs.erase(Vs.find(r-l));
            Vs.insert(x-l);
            Vs.insert(r-x);
            V.insert(x);
            cout<<(*Hs.rbegin())*(*Vs.rbegin())<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
#define LL long long
using namespace std;
const int N=200000+10;
int w,h,n;
set<int>X,Y;
multiset<int>lx,ly;
multiset<int>::iterator it;
inline int read(){
	int x=0,z=1;char y=getchar();
	while(y<'0'||y>'9'){if(y=='-')z=-1;y=getchar();}
	while(y>='0'&&y<='9')x=x*10+y-'0',y=getchar();
	return x*z;
}
int main(){
	X.insert(0),X.insert(w=read());
	Y.insert(0),Y.insert(h=read());
	lx.insert(w),ly.insert(h);
	n=read();
	while(n--){
		char opt=getchar();
		while(opt!='H'&&opt!='V')opt=getchar();
		int a=read(),l,r;
		if(opt=='V'){//x
			X.insert(a);
			it=X.find(a);
			l=*(--it);
			r=*(++++it);
			lx.erase(lx.find(r-l));
			lx.insert(a-l),lx.insert(r-a);
		}
		else{//y
			Y.insert(a);
			it=Y.find(a);
			l=*(--it);
			r=*(++++it);
			ly.erase(ly.find(r-l));
			ly.insert(a-l),ly.insert(r-a);
		}
		printf("%lld\n",1ll*(*(--lx.end()))*(*(--ly.end())));
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e6+7;
set<int> C,K,s;
multiset<int> c,k;
int main()
{
	int w,h,n;cin>>w>>h>>n;
	C.insert(0);C.insert(w);c.insert(w);
	K.insert(0);K.insert(h);k.insert(h);
	for(int i=1;i<=n;i++){
		char op;int v;
		scanf(" %c%d",&op,&v);
		if(op=='H'){
			set<int>::iterator l=K.lower_bound(v);
			set<int>::iterator r=l--;
			int len=(*r)-(*l);
			k.erase(k.lower_bound(len));
			k.insert(v-(*l));
			k.insert((*r)-v);
			K.insert(v);
		}
		else{
			set<int>::iterator l=C.lower_bound(v);
			set<int>::iterator r=l--;
			int len=(*r)-(*l);
			c.erase(c.lower_bound(len));
			c.insert(v-(*l));
			c.insert((*r)-v);
			C.insert(v);
		}
		int maxc=*c.rbegin(),maxk=*k.rbegin();
		cout<<1LL*maxc*maxk<<endl;
	}
	return 0;
}


#include<iostream>
#define reg register
#define rep(i,j,k) for(reg ll i=j;i<=k;++i)
#define MAXN 200001
#define ll long long
#define lson id<<1
#define rson id<<1|1
using namespace std;
ll w,h,n;
struct node
{
	ll l,r,mx,ls,rs;
	bool flag;
}tree[3][MAXN<<2];
inline ll Max(ll x,ll y,ll z)
{
	return x>y?(x>z?x:z):(y>z?y:z);
}
inline void push_up(ll id,short k)
{
	tree[k][id].flag=tree[k][lson].flag&&tree[k][rson].flag;
	tree[k][id].l=tree[k][lson].flag?tree[k][lson].mx+tree[k][rson].l:tree[k][lson].l;
	tree[k][id].r=tree[k][rson].flag?tree[k][rson].mx+tree[k][lson].r:tree[k][rson].r;
	tree[k][id].mx=Max(tree[k][lson].r+tree[k][rson].l,tree[k][lson].mx,tree[k][rson].mx);
	return;
}
void build(ll id,ll left,ll right,short k)
{
	tree[k][id].ls=left;
	tree[k][id].rs=right;
//	cout<<k<<' '<<id<<' '<<tree[k][id].ls<<' '<<tree[k][id].rs<<'\n';
	if (left==right)
	{
		tree[k][id].mx=1;
		tree[k][id].l=1;
		tree[k][id].r=1;
		tree[k][id].flag=true;
		return;
	}
	ll mid=(left+right)>>1;
	build(lson,left,mid,k);
	build(rson,mid+1,right,k);
	push_up(id,k);
	return;
}
void ask(ll id,ll key,short k)
{
//	cout<<id<<" ####"<<key<<' '<<k<<' '<<(lson)<<' '<<(rson)<<' '<<tree[k][id].ls<<' '<<tree[k][id].rs<<'\n';
	if (tree[k][id].ls==key&&tree[k][id].rs==key)
	{
		tree[k][id].flag=false;
		tree[k][id].mx=0;
		tree[k][id].l=0;
		tree[k][id].r=0;
		return;
	}
	ll mid=(tree[k][id].ls+tree[k][id].rs)>>1;
	if (key<=mid) ask(lson,key,k);
	else ask(rson,key,k);
	push_up(id,k);
//	cout<<tree[k][id].l<<' '<<tree[k][id].r<<' '<<tree[k][id].mx<<' '<<tree[k][id].flag<<'\n';
}
int main(void)
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin>>w>>h>>n;
	build(1,1,h-1,1);
	build(1,1,w-1,2);
	rep(i,1,n)
	{
		char ch;
		cin>>ch;
		if (ch=='H')
		{
			ll x;
			cin>>x;
			ask(1,x,1);
		}
		if (ch=='V')
		{
			ll y;
			cin>>y;
			ask(1,y,2);
		}
		cout<<(tree[1][1].mx+1)*(tree[2][1].mx+1)<<'\n';
	}
	return 0;
}
/*
4 3 4
H 2
V 2
V 3
V 1

8
4
4
2

7 6 5
H 4
V 3
V 5
H 2
V 1

28
16
12
6
4
*/


# include <iostream>
# include <cstdio>
# include <set>
# pragma GCC optimize(2)

using namespace std ;

int w , h , n ;

multiset <int> sx ;
multiset <int> sy ;
set <int> x ;
set <int> y ;
int main()
{
	scanf("%d%d%d" , &w , &h , &n) ;
	x.insert( 0 ) ;
	x.insert( h ) ;
	y.insert( w ) ;
	y.insert( 0 ) ;
	sx.insert( h ) ;
	sy.insert( w ) ;
	for ( int i = 1 ; i <= n ; i++ )
	{
		char c ;
		int p ;
		cin >> c ;
		scanf("%d" , &p) ;

		if( c == 'V' )
		{
			y.insert( p ) ;
			set < int > :: iterator it1 , it2 ;
			it1 = y.lower_bound( p ) ;
			it2 = y.upper_bound( p ) ;
			-- it1 ;

			int ls , rs ;
			ls = p - *it1 ;
			rs = *it2 - p ;
			int ss = *it2 - *it1 ;
			sy.erase( sy.find(ss) ) ;
			sy.insert( ls );
			sy.insert( rs );
		}
		else
		{
			x.insert( p );
			set < int > :: iterator it1 , it2 ;
			it1 = x.lower_bound(p) ;
			it2 = x.upper_bound(p) ;
			--it1 ;

			int ls , rs ;
			ls = p - *it1;
			rs = *it2 - p ;
			int ss = *it2 - *it1;
			sx.erase( sx.find( ss ) ) ;
			sx.insert( rs ) ;
			sx.insert( ls ) ;

		}
		int a,b ;
		a = * ( --sx.end() ) ;
		b = * ( --sy.end() ) ;
		printf("%lld\n" , 1ll *a*b) ;
	}

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define maxn 200010
#define ls rt << 1
#define rs rt << 1 | 1
#define M ((ll + rr) >> 1)
/*
 线段树模板题：
1.维护区间里最长连续0的个数
2.点信息->区间信息

*/
typedef long long LL;
LL ma[maxn << 2][2];
/*要维护四个值*/
LL lt[maxn << 2][2];
LL rt[maxn << 2][2];
LL l[maxn << 2][2];  //标记区间的从左开始的连续0长度
LL r[maxn << 2][2];  //从右开始
bool pure[maxn << 2][2];

char op[2];
const LL minn = -(1 << 62);
LL w, h;  //MLE

void pushUp(LL k, LL rt) {
	pure[rt][k] = pure[ls][k] && pure[rs][k];
	ma[rt][k] = max(l[rs][k] + r[ls][k], max(ma[ls][k], ma[rs][k]));
	l[rt][k] = pure[ls][k] ? l[ls][k] + l[rs][k] : l[ls][k];
	r[rt][k] = pure[rs][k] ? r[rs][k] + r[ls][k] : r[rs][k];
}

void build(LL k, LL ll, LL rr, LL rt) {
	if (ll == rr) {
		pure[rt][k] = true;
		ma[rt][k] = 1;
		l[rt][k] = 1;
		r[rt][k] = 1;
		return;
	}
	build(k, ll, M, ls);
	build(k, M + 1, rr, rs);
	pushUp(k, rt);
}

//加上一个数之后进行维护
void update(LL k, LL x, LL ll, LL rr, LL rt) {
	if (ll == rr) {
		pure[rt][k] = false;
		ma[rt][k] = 0;
		l[rt][k] = 0;
		r[rt][k] = 0;
		return;
	}
	if (M >= x) update(k, x, ll, M, ls);
	//if (M < x) update(k, x, rs);
	else update(k, x, M + 1, rr, rs);
	pushUp(k, rt);
}

int main() {
	int m;
	LL k;
	scanf("%lld%lld%d", &w, &h, &m);  //设数列长度最大为m!!（固定了）
	build(0, 1, w - 1, 1);
	build(1, 1, h - 1, 1);

	for (int i = 0; i < m; ++i) {
		/*洛谷输入问题?*/
		//scanf("%*c%c %lld", &c, &k);  //这种输入方式在本机上可以正常跑过样例，但是交上去MLE
		//scanf("%c %lld", &c, &k);  //配合getchar()使用也是同上的效果
		/*可以AC的写法*/
		scanf("%s %lld", op, &k);  //1.按照字符数组读入s的话可以AC
		//cin >> c;  //2.用cin读入字符也可以
		//scanf("%lld", &k);
		//cout << c << ' ' << k << endl;
		if (op[0] == 'H'){
			update(1, k, 1, h - 1, 1);
		} else {
			update(0, k, 1, w - 1, 1);
		}
		printf("%lld\n", (ma[1][0] + 1) * (ma[1][1] + 1));
	}
	return 0;
}


#include <iostream>
#include <fstream>
#include <cmath>
#include <cstring>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <map>
#include <bitset>
#include <set>
//#include <cstdint>
#include <algorithm>

using namespace std;
/*
enum ctype{
    none  =0x00,
    x_axis=0x01,
    y_axis=0x02
};

class sqr{
private:
    unsigned int w,h;
    unsigned char cut=none,wh=0;
public:
    sqr *l=NULL,*r=NULL;
public:
    sqr(){}
    sqr(unsigned int aw,unsigned int ah):w(aw),h(ah){}

    inline unsigned int maxArea(){
        return cut?max(l->maxArea(),r->maxArea()):w*h;
    }
    void cut_h(unsigned int _wh){
        if(_wh==0||_wh==h)return;
        switch(cut){
            case none:
                cut=x_axis;
                wh=_wh;
                l=new sqr(w,wh);
                r=new sqr(w,h-wh);
                break;
            case x_axis:
                if(wh==_wh)break;
                else ((_wh>wh)?(r):(l))->cut_h((_wh>wh)?(_wh-wh):_wh);
                break;
            case y_axis:
                l->cut_h(_wh);
                r->cut_h(_wh);
                break;
            default:
                //cnm
                break;
        }
    }
    void cut_v(unsigned int _wh){
        if(_wh==0||_wh==w)return;
        switch(cut){
            case none:
                cut=y_axis;
                wh=_wh;
                l=new sqr(wh,h);
                r=new sqr(w-wh,h);
                break;
            case x_axis:
                l->cut_v(_wh);
                r->cut_v(_wh);
                break;
            case y_axis:
                if(wh==_wh)break;
                else ((_wh>wh)?(r):(l))->cut_v((_wh>wh)?(_wh-wh):_wh);
                break;
            default:
                //cnm
                break;
        }
    }
};
*/
int main(int argc , char **argv){

    unsigned int n,w,h; cin>>w>>h>>n;

    multiset<unsigned int> x,y;

    x.insert(w);    y.insert(h);
    x.insert(0);    y.insert(0);

    char opt;   unsigned int p;

    unsigned int lx,ly;

    multiset<unsigned int>::iterator it;

    while(n--){

        cin>>opt>>p;

        if(opt=='H')y.insert(p);
        else        x.insert(p);

        it=x.begin();   it++;
        unsigned int last=*(x.begin()),xmax=0;
        for(;it!=x.end();last=*(it++))xmax=max(xmax,(*it)-last);

        it=y.begin();   it++;
        last=*(y.begin());
        unsigned int ymax=0;
        for(;it!=y.end();last=*(it++))ymax=max(ymax,(*it)-last);

        cout<<xmax*ymax<<endl;

    }

    return 0;

}


#include <iostream>
#define N 1000000
#define int long long
using namespace std;
int v[N][5],vl[N][5],vr[N][5],n,m,q;
void pushup(int rt,int l,int r,int id)
{
	int m=(l+r)>>1;
	v[rt][id]=max(v[rt<<1][id],v[rt<<1|1][id]);
	v[rt][id]=max(v[rt][id],vr[rt<<1][id]+vl[rt<<1|1][id]);
	vl[rt][id]=vl[rt<<1][id];
	vr[rt][id]=vr[rt<<1|1][id];
	if (vl[rt<<1][id]==m-l+1) vl[rt][id]+=vl[rt<<1|1][id];
	if (vr[rt<<1|1][id]==r-m) vr[rt][id]+=vr[rt<<1][id];
	return;
}
void build(int rt,int l,int r,int id)
{
	v[rt][id]=vl[rt][id]=vr[rt][id]=r-l+1;
	if (l==r) return;
	int m=(l+r)>>1;
	build(rt<<1,l,m,id);
	build(rt<<1|1,m+1,r,id);
	pushup(rt,l,r,id);
	return;
}
void update(int rt,int l,int r,int x,int id)
{
	if (l==r)
	{
		v[rt][id]=vl[rt][id]=vr[rt][id]=0;
		return;
	}
	int m=(l+r)>>1;
	if (x<=m) update(rt<<1,l,m,x,id);
	else update(rt<<1|1,m+1,r,x,id);
	pushup(rt,l,r,id);
	return;
}
signed main ()
{
	cin>>n>>m>>q;
	build(1,1,n-1,1);
	build(1,1,m-1,2);
	while (q--)
	{
		char c;
		int x;
		cin>>c>>x;
		if (c=='V') update(1,1,n-1,x,1);
		else update(1,1,m-1,x,2);
		cout<<(v[1][1]+1)*(v[1][2]+1)<<endl;
	}
	return 0;
}


#include<cstdio>
#include<iostream>
#define ri register int
using namespace std;
const int N=2e5+10;
int w,h,n;

struct node{
	int left,right;
	int maxn,lmax,rmax;
}disy[N<<2];

struct nod{
	int up,down;
	int maxn,upmax,dowx;
}disx[N<<2];

int read(){
	char ch=getchar();int re=0,op=1;
	while(ch<'0'||ch>'9'){
		if(ch=='-') op=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		re=(re<<3)+(re<<1)+ch-'0';
		ch=getchar();
	}
	return re*op;
}

void buildx(int id,int l,int r){
	disy[id].left=l;disy[id].right=r;
	if(l==r){
		disy[id].maxn=disy[id].lmax=disy[id].rmax=1;
		return ;
	}
	int mid=l+r>>1;
	buildx(id<<1,l,mid);buildx(id<<1|1,mid+1,r);
	disy[id].maxn=max(max(disy[id<<1].maxn,disy[id<<1|1].maxn),disy[id<<1].rmax+disy[id<<1|1].lmax);
	if(disy[id<<1].lmax==disy[id<<1].right-disy[id<<1].left+1) disy[id].lmax=disy[id<<1].lmax+disy[id<<1|1].lmax;
	else disy[id].lmax=disy[id<<1].lmax;
	if(disy[id<<1|1].rmax==disy[id<<1|1].right-disy[id<<1|1].left+1) disy[id].rmax=disy[id<<1].rmax+disy[id<<1|1].rmax;
	else disy[id].rmax=disy[id<<1|1].rmax;
}

void buildy(int id,int l,int r){
	disx[id].up=l;disx[id].down=r;
	if(l==r){
		disx[id].upmax=disx[id].dowx=disx[id].maxn=1;
		return ;
	}
	int mid=l+r>>1;
	buildy(id<<1,l,mid);buildy(id<<1|1,mid+1,r);
	disx[id].maxn=max(max(disx[id<<1].maxn,disx[id<<1|1].maxn),disx[id<<1].dowx+disx[id<<1|1].upmax);
	if(disx[id<<1].upmax==disx[id<<1].down-disx[id<<1].up+1) disx[id].upmax=disx[id<<1].upmax+disx[id<<1|1].upmax;
	else disx[id].upmax=disx[id<<1].upmax;
	if(disx[id<<1|1].dowx==disx[id<<1|1].down-disx[id<<1|1].up+1) disx[id].dowx=disx[id<<1].dowx+disx[id<<1|1].dowx;
	else disx[id].dowx=disx[id<<1|1].dowx;
}

void cut(int kind,int size,int l,int r,int id){
	if(l==r){
		if(kind==1) disx[id].upmax=disx[id].dowx=disx[id].maxn=0;
		else disy[id].maxn=disy[id].lmax=disy[id].rmax=0;
		return ;
	}
	int mid=l+r>>1;
	if(size<=mid) cut(kind,size,l,mid,id<<1);
	else cut(kind,size,mid+1,r,id<<1|1);
	if(kind==2){
		disy[id].maxn=max(max(disy[id<<1].maxn,disy[id<<1|1].maxn),disy[id<<1].rmax+disy[id<<1|1].lmax);
		if(disy[id<<1].lmax==disy[id<<1].right-disy[id<<1].left+1) disy[id].lmax=disy[id<<1].lmax+disy[id<<1|1].lmax;
		else disy[id].lmax=disy[id<<1].lmax;
		if(disy[id<<1|1].rmax==disy[id<<1|1].right-disy[id<<1|1].left+1) disy[id].rmax=disy[id<<1].rmax+disy[id<<1|1].rmax;
		else disy[id].rmax=disy[id<<1|1].rmax;
	}
	else if(kind==1){
		disx[id].maxn=max(max(disx[id<<1].maxn,disx[id<<1|1].maxn),disx[id<<1].dowx+disx[id<<1|1].upmax);
		if(disx[id<<1].upmax==disx[id<<1].down-disx[id<<1].up+1) disx[id].upmax=disx[id<<1].upmax+disx[id<<1|1].upmax;
		else disx[id].upmax=disx[id<<1].upmax;
		if(disx[id<<1|1].dowx==disx[id<<1|1].down-disx[id<<1|1].up+1) disx[id].dowx=disx[id<<1].dowx+disx[id<<1|1].dowx;
		else disx[id].dowx=disx[id<<1|1].dowx;
	}
}

int main(){
	w=read(),h=read(),n=read();
	buildx(1,1,w-1);buildy(1,1,h-1);
	for(ri i=1;i<=n;i++){
		char ch=getchar();int size;
		while(ch<'A'||ch>'Z') ch=getchar();
		size=read();
		if(ch=='H') cut(1,size,1,h-1,1);
		else cut(2,size,1,w-1,1);
		printf("%d\n",(1+disx[1].maxn)*(1+disy[1].maxn));
	}
	return 0;
}


#include<iostream>
#include<cstring>
#include<set>
using namespace std;
int main() {
	ios::sync_with_stdio(false);
	int i, j, k, ih, iv;
	int w, h, n, len, lger, ster;
	char hv[10] = { '0' };
	set<int> dv, dh;
	set<int> Hi, Vi;
	set<int>::iterator it;
	while (cin >> w >> h >> n) {
		Hi.clear(), Vi.clear();
		dh.clear(), dv.clear();
		Hi.insert(0), Hi.insert(h);
		Vi.insert(0), Vi.insert(w);
		dh.insert(h), dv.insert(w);
		while (n--) {
			cin >> hv >> len;
			getchar();
			if (hv[0] == 'H') {
				it = Hi.upper_bound(len);
				lger = *it;
				ster = *(--it);
				it = dh.find(lger - ster);
				if (it != dh.end()) {
					dh.erase(it);
				}
				dh.insert(lger - len);
				dh.insert(len - ster);
				Hi.insert(len);
				it = dh.end(), it--;
				ih = *it;
				it = dv.end(), it--;
				iv = *it;
				printf("%d\n", ih*iv);
			}
			else {
				it = Vi.upper_bound(len);
				lger = *it;
				ster = *(--it);
				it = dv.find(lger - ster);
				if (it != dv.end()) {
					dv.erase(it);
				}
				dv.insert(lger - len);
				dv.insert(len - ster);
				Vi.insert(len);
				it = dh.end(), it--;
				ih = *it;
				it = dv.end(), it--;
				iv = *it;
				printf("%d\n", ih*iv);
			}
		}
	}
	return 0;
}


#include<iostream>
#include<cstring>
#include<set>
using namespace std;
typedef long long ll;
int main() {
	ios::sync_with_stdio(false);
	int i, j, k, ih, iv;
	int w, h, n, len, lger, ster;
	char hv[10] = { '0' };
	multiset<int> dv, dh;
	multiset<int> Hi, Vi;
	multiset<int>::iterator it;
	ll ans;
	while (cin >> w >> h >> n) {
		Hi.clear(), Vi.clear();
		dh.clear(), dv.clear();
		Hi.insert(0), Hi.insert(h);
		Vi.insert(0), Vi.insert(w);
		dh.insert(h), dv.insert(w);
		while (n--) {
			cin >> hv >> len;
			getchar();
			if (hv[0] == 'H') {
				it = Hi.upper_bound(len);
				lger = *it;
				ster = *(--it);
				it = dh.find(lger - ster);
				if (it != dh.end()) {
					dh.erase(it);
				}
				dh.insert(lger - len);
				dh.insert(len - ster);
				Hi.insert(len);
				//printf("%d\n", ih*iv);
			}
			else {
				it = Vi.upper_bound(len);
				lger = *it;
				ster = *(--it);
				it = dv.find(lger - ster);
				if (it != dv.end()) {
					dv.erase(it);
				}
				dv.insert(lger - len);
				dv.insert(len - ster);
				Vi.insert(len);
			}
			it = dh.end(), it--;
			ih = *it;
			it = dv.end(), it--;
			iv = *it;
			ans = (ll)(iv*ih);
			cout << ans << endl;
		}
	}
	return 0;
}


#include<iostream>
#include<cstring>
#include<set>
using namespace std;
typedef long long ll;
int main() {
	ios::sync_with_stdio(false);
	int i, j, k, ih, iv;
	int w, h, n, len, lger, ster;
	char hv[10] = { '0' };
	multiset<int> dv, dh;
	multiset<int> Hi, Vi;
	multiset<int>::iterator it, pre, next;
	ll ans;
	cin >> w >> h >> n;
		Hi.clear(), Vi.clear();
		dh.clear(), dv.clear();
		Hi.insert(0), Hi.insert(h);
		Vi.insert(0), Vi.insert(w);
		dh.insert(h), dv.insert(w);
		while (n--) {
			cin >> hv;
			getchar();
			if (hv[0] == 'H') {
				cin >> len;
				getchar();
				Hi.insert(len);
				pre = next = Hi.find(len);
				pre--, next++;
				lger = *next;
				ster = *pre;
				it = dh.find(lger - ster);
				if (it != dh.end()) {
					dh.erase(it);
				}
				dh.insert(lger - len);
				dh.insert(len - ster);
				//printf("%d\n", ih*iv);
			}
			else if (hv[0] == 'H') {
				cin >> len;
				getchar();
				Vi.insert(len);
				pre = next = Vi.find(len);
				pre--, next++;
				lger = *next;
				ster = *pre;
				it = dv.find(lger - ster);
				if (it != dv.end()) {
					dv.erase(it);
				}
				dv.insert(lger - len);
				dv.insert(len - ster);
			}
			it = dh.end(), it--;
			ih = *it;
			it = dv.end(), it--;
			iv = *it;
			ans = (ll)(iv*ih);
			cout << ans << endl;
		}
	return 0;
}


#include<iostream>
#include<cstring>
#include<set>
using namespace std;
typedef long long ll;
int main() {
	ios::sync_with_stdio(false);
	int i, j, k, ih, iv;
	int w, h, n, len, lger, ster;
	char hv[10] = { '0' };
	multiset<int> dv, dh;
	multiset<int> Hi, Vi;
	multiset<int>::iterator it,pre,next;
	ll ans;
	cin >> w >> h >> n;
		Hi.clear(), Vi.clear();
		dh.clear(), dv.clear();
		Hi.insert(0), Hi.insert(h);
		Vi.insert(0), Vi.insert(w);
		dh.insert(h), dv.insert(w);
		while (n--) {
			cin >> hv;
			getchar();
			if (hv[0] == 'H') {
				cin >> len;
				getchar();
				Hi.insert(len);
				pre=next= Hi.find(len);
				pre--, next++;
				lger = *next;
				ster = *pre;
				it = dh.find(lger - ster);
				if (it != dh.end()) {
					dh.erase(it);
				}
				dh.insert(lger - len);
				dh.insert(len - ster);
				//printf("%d\n", ih*iv);
			}
			else if(hv[0]=='V'){
				cin >> len;
				getchar();
				Vi.insert(len);
				pre=next = Vi.find(len);
				pre--, next++;
				lger = *next;
				ster = *pre;
				it = dv.find(lger - ster);
				if (it != dv.end()) {
					dv.erase(it);
				}
				dv.insert(lger - len);
				dv.insert(len - ster);
			}
			it = dh.end(), it--;
			ih = *it;
			it = dv.end(), it--;
			iv = *it;
			ans = (ll)(iv*ih);
			cout << ans << endl;
		}

	return 0;
}


#include<iostream>
#include<cstring>
#include<set>
using namespace std;
int main() {
	ios::sync_with_stdio(false);
	int i, j, k, ih, iv;
	int w, h, n, len, lger, ster;
	char hv[10] = { '0' };
	multiset<int> dv, dh;
	multiset<int> Hi, Vi;
	multiset<int>::iterator it;
	while (cin >> w >> h >> n) {
		Hi.clear(), Vi.clear();
		dh.clear(), dv.clear();
		Hi.insert(0), Hi.insert(h);
		Vi.insert(0), Vi.insert(w);
		dh.insert(h), dv.insert(w);
		while (n--) {
			cin >> hv >> len;
			getchar();
			if (hv[0] == 'H') {
				it = Hi.upper_bound(len);
				lger = *it;
				ster = *(--it);
				it = dh.find(lger - ster);
				if (it != dh.end()) {
					dh.erase(it);
				}
				dh.insert(lger - len);
				dh.insert(len - ster);
				Hi.insert(len);
				it = dh.end(), it--;
				ih = *it;
				it = dv.end(), it--;
				iv = *it;
				printf("%d\n", ih*iv);
			}
			else {
				it = Vi.upper_bound(len);
				lger = *it;
				ster = *(--it);
				it = dv.find(lger - ster);
				if (it != dv.end()) {
					dv.erase(it);
				}
				dv.insert(lger - len);
				dv.insert(len - ster);
				Vi.insert(len);
				it = dh.end(), it--;
				ih = *it;
				it = dv.end(), it--;
				iv = *it;
				printf("%d\n", ih*iv);
			}
		}
	}
	return 0;
}


#include<iostream>
#include<cstring>
#include<set>
using namespace std;
typedef long long ll;
int main() {
	ios::sync_with_stdio(false);
	int i, j, k, ih, iv;
	int w, h, n, len, lger, ster;
	char hv[10] = { '0' };
	multiset<int> dv, dh;
	multiset<int> Hi, Vi;
	multiset<int>::iterator it,pre,next;
	ll ans;
	while (cin >> w >> h >> n) {
		Hi.clear(), Vi.clear();
		dh.clear(), dv.clear();
		Hi.insert(0), Hi.insert(h);
		Vi.insert(0), Vi.insert(w);
		dh.insert(h), dv.insert(w);
		while (n--) {
			cin >> hv;
			getchar();
			if (hv[0] == 'H') {
				cin >> len;
				getchar();
				Hi.insert(len);
				pre=next= Hi.find(len);
				pre--, next++;
				lger = *next;
				ster = *pre;
				it = dh.find(lger - ster);
				if (it != dh.end()) {
					dh.erase(it);
				}
				dh.insert(lger - len);
				dh.insert(len - ster);
				//printf("%d\n", ih*iv);
			}
			else {
				cin >> len;
				getchar();
				Vi.insert(len);
				pre=next = Vi.find(len);
				pre--, next++;
				lger = *next;
				ster = *pre;
				it = dv.find(lger - ster);
				if (it != dv.end()) {
					dv.erase(it);
				}
				dv.insert(lger - len);
				dv.insert(len - ster);
			}
			it = dh.end(), it--;
			ih = *it;
			it = dv.end(), it--;
			iv = *it;
			ans = (ll)(iv*ih);
			cout << ans << endl;
		}
	}
	return 0;
}


#include <iostream>
#include <stdio.h>
#include <set>
#include <string>
#include <queue>

using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	int w, h, n;
	cin >> w >> h >> n;
	set<int> qh, qv;
	multiset<int> mh, mv;
	qh.insert(h);
	qh.insert(0);
	qv.insert(w);
	qv.insert(0);
	mh.insert(h);
	mv.insert(w);
	char s[5];
	for (int i = 0; i < n; i++)
	{
		scanf("%s", s);
		multiset<int> ::iterator iter, pre, next;
		multiset<int> ::iterator era;
		if (s[0] == 'H')
		{
			int y;
			cin >> y;
			qh.insert(y);
			pre = next = iter = qh.find(y);
			pre--;
			next++;
			era = mh.find(*next - *pre);
			mh.erase(era);
			mh.insert(y - *pre);
			mh.insert(*next - y);
		}
		else if (s[0] == 'V')
		{
			int x;
			cin >> x;
			qv.insert(x);
			pre = next = iter = qv.find(x);
			pre--;
			next++;
			era = mv.find(*next - *pre);
			mv.erase(era);
			mv.insert(x - *pre);
			mv.insert(*next - x);
		}
		multiset<int> ::iterator iterh, iterv;
		iterh = mh.end();
		iterh--;
		iterv = mv.end();
		iterv--;
		long long ans = (long long)(*iterh) * (*iterv);
		printf("%I64d\n", ans);
	}
	return 0;
}