/*
#include<deque>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<algorithm>
#include<functional>
#include<iterator>
#include<locale>
#include<memory>
#include<stdexcept>
#include<utility>
#include<string>
#include<fstream>
#include<ios>
#include<iostream>
#include<iosfwd>
#include<iomanip>
#include<istream>
#include<ostream>
#include<sstream>
#include<streambuf>
#include<complex>
#include<numeric>
#include<valarray>
#include<exception>
#include<limits>
#include<new>
#include<typeinfo>*/
#include <bits/stdc++.h>

#define fp 				pop_front
#define bp 				pop_back
#define all(x) 			x.begin() , x.end()
#define mp 				make_pair
#define pb 				push_back
#define pf 				push_front
#define se 				second
#define f 				first
#define sz 				size()
#define sqr(x) 			((x) * (x))
#define cub(x) 			sqr(x) * (x)
#define ios 			std::ios_base::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0);
#define y1 				qazwsxedcrfvtgbyhnujmik
#define LOGMAX          17
#define MX              1 << 22
#define l(n)            n << 1
#define r(n)            (n << 1) + 1
#define FIND(N,pos)     ((N) & (1 << (pos)))
#define sf(h)           scanf("%d",&h)
#define sff(h,b)        scanf("%d%d",&h,&b)
#define sfff(h,b,c)     scanf("%d%d%d",&h,&b,&c)
#define TCASE(test)     for(int z = 1;z <= test;z++)
#define PRINT           printf("Case %d:\n",z)
#define en              "\n"
#define lwb             lower_bound
#define upb             upper_bound
#define	pii				pair < int , int >
#define	pil				pair < int , long long >
#define	pli				pair < long long , int >
#define	pll				pair < long long , long long >
#define int 			long long

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const int inf = 1e9 + 7;
const ll ll_inf = 1e18 + 420;
const double eps = 1e-4;
const int N = 1e6 + 7;
const int MAX = 2e5 + 9;

int w, h, n, k;
char c;
multiset < int > msx, msy, msdx, msdy;

main(){
	ios
	cin >> w >> h >> n;
	msx.insert(w);
	msy.insert(h);
	msx.insert(0);
	msy.insert(0);
	msdx.insert(w);
	msdy.insert(h);
	for(int i = 0; i < n; ++i){
	 	cin >> c >> k;
	 	if(c == 'H'){
	 	 	msy.insert(k);
	 	 	int last = *(msy.upb(k)) - *(--msy.lwb(k));
	 	 	//cout << last ;
	 	 	//return 0;
	 	 	int res1 = *(msy.lwb(k)) - *(--msy.lwb(k));
	 	 	int res2 = *(msy.upb(k)) - *(msy.lwb(k));
	 	 	//cout << res1 << " " << res2;
	 	 	//return 0;
	 	 	msdy.erase(msdy.find(last));
	 	 	msdy.insert(res1);
	 	 	msdy.insert(res2);
	 	}
	 	else{
	 		//cout << 1 << en;
	 	 	msx.insert(k);
	 	 	//cout << 1 << en;
	 	 	int last = *(msx.upb(k)) - *(--msx.lwb(k));
	 	 	int res1 = *(msx.lwb(k)) - *(--msx.lwb(k));
	 	 	int res2 = *(msx.upb(k)) - *(msx.lwb(k));
	 	 	//cout << 1 << en;
	 	 	//cout << last << en;
	 	 	msdx.erase(msdx.find(last));
	 	 	//cout << 1 << en;
	 	 	msdx.insert(res1);
	 	 	msdx.insert(res2);
	 	 	//cout << 1 << en;
	 	 	//cout << res1 << " " << res2 << en;
	 	}
	 	cout <<( *(msdy.rbegin())) * (*(msdx.rbegin())) << en;
	}
}


/*
#include<deque>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<algorithm>
#include<functional>
#include<iterator>
#include<locale>
#include<memory>
#include<stdexcept>
#include<utility>
#include<string>
#include<fstream>
#include<ios>
#include<iostream>
#include<iosfwd>
#include<iomanip>
#include<istream>
#include<ostream>
#include<sstream>
#include<streambuf>
#include<complex>
#include<numeric>
#include<valarray>
#include<exception>
#include<limits>
#include<new>
#include<typeinfo>*/
#include <bits/stdc++.h>

#define fp 				pop_front
#define bp 				pop_back
#define all(x) 			x.begin() , x.end()
#define mp 				make_pair
#define pb 				push_back
#define pf 				push_front
#define se 				second
#define f 				first
#define sz 				size()
#define sqr(x) 			((x) * (x))
#define cub(x) 			sqr(x) * (x)
#define ios 			std::ios_base::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0);
#define y1 				qazwsxedcrfvtgbyhnujmik
#define LOGMAX          17
#define MX              1 << 22
#define l(n)            n << 1
#define r(n)            (n << 1) + 1
#define FIND(N,pos)     ((N) & (1 << (pos)))
#define sf(h)           scanf("%d",&h)
#define sff(h,b)        scanf("%d%d",&h,&b)
#define sfff(h,b,c)     scanf("%d%d%d",&h,&b,&c)
#define TCASE(test)     for(int z = 1;z <= test;z++)
#define PRINT           printf("Case %d:\n",z)
#define en              "\n"
#define lwb             lower_bound
#define upb             upper_bound
#define	pii				pair < int , int >
#define	pil				pair < int , long long >
#define	pli				pair < long long , int >
#define	pll				pair < long long , long long >
#define int long long

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const int inf = 1e9 + 7;
const ll ll_inf = 1e18 + 420;
const double eps = 1e-4;
const int N = 1e6 + 7;
const int MAX = 2e5 + 9;

int w, h, n, k;
char c;
multiset < int > msx, msy, msdx, msdy;

main(){
	cin >> w >> h >> n;
	msx.insert(w);
	msy.insert(h);
	msx.insert(0);
	msy.insert(0);
	msdx.insert(w);
	msdy.insert(h);
	for(int i = 0; i < n; ++i){
	 	cin >> c >> k;
	 	if(c == 'H'){
	 	 	msy.insert(k);
	 	 	int last = *(msy.upb(k)) - *(--msy.lwb(k));
	 	 	//cout << last ;
	 	 	//return 0;
	 	 	int res1 = *(msy.lwb(k)) - *(--msy.lwb(k));
	 	 	int res2 = *(msy.upb(k)) - *(msy.lwb(k));
	 	 	//cout << res1 << " " << res2;
	 	 	//return 0;
	 	 	msdy.erase(msdy.find(last));
	 	 	msdy.insert(res1);
	 	 	msdy.insert(res2);
	 	}
	 	else{
	 		//cout << 1 << en;
	 	 	msx.insert(k);
	 	 	//cout << 1 << en;
	 	 	int last = *(msx.upb(k)) - *(--msx.lwb(k));
	 	 	int res1 = *(msx.lwb(k)) - *(--msx.lwb(k));
	 	 	int res2 = *(msx.upb(k)) - *(msx.lwb(k));
	 	 	//cout << 1 << en;
	 	 	//cout << last << en;
	 	 	msdx.erase(msdy.find(last));
	 	 	//cout << 1 << en;
	 	 	msdx.insert(res1);
	 	 	msdx.insert(res2);
	 	}
	 	cout <<( *(msdy.rbegin())) * (*(msdx.rbegin())) << en;
	}
}


/*
#include<deque>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<algorithm>
#include<functional>
#include<iterator>
#include<locale>
#include<memory>
#include<stdexcept>
#include<utility>
#include<string>
#include<fstream>
#include<ios>
#include<iostream>
#include<iosfwd>
#include<iomanip>
#include<istream>
#include<ostream>
#include<sstream>
#include<streambuf>
#include<complex>
#include<numeric>
#include<valarray>
#include<exception>
#include<limits>
#include<new>
#include<typeinfo>*/
#include <bits/stdc++.h>

#define fp 				pop_front
#define bp 				pop_back
#define all(x) 			x.begin() , x.end()
#define mp 				make_pair
#define pb 				push_back
#define pf 				push_front
#define se 				second
#define f 				first
#define sz 				size()
#define sqr(x) 			((x) * (x))
#define cub(x) 			sqr(x) * (x)
#define ios 			std::ios_base::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0);
#define y1 				qazwsxedcrfvtgbyhnujmik
#define LOGMAX          17
#define MX              1 << 22
#define l(n)            n << 1
#define r(n)            (n << 1) + 1
#define FIND(N,pos)     ((N) & (1 << (pos)))
#define sf(h)           scanf("%d",&h)
#define sff(h,b)        scanf("%d%d",&h,&b)
#define sfff(h,b,c)     scanf("%d%d%d",&h,&b,&c)
#define TCASE(test)     for(int z = 1;z <= test;z++)
#define PRINT           printf("Case %d:\n",z)
#define en              "\n"
#define lwb             lower_bound
#define upb             upper_bound
#define	pii				pair < int , int >
#define	pil				pair < int , long long >
#define	pli				pair < long long , int >
#define	pll				pair < long long , long long >

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const int inf = 1e9 + 7;
const ll ll_inf = 1e18 + 420;
const double eps = 1e-4;
const int N = 1e6 + 7;
const int MAX = 2e5 + 9;

int w, h, n, k;
char c;
multiset < int > msx, msy, msdx, msdy;

main(){
	ios
	cin >> w >> h >> n;
	msx.insert(w);
	msy.insert(h);
	msx.insert(0);
	msy.insert(0);
	msdx.insert(w);
	msdy.insert(h);
	for(int i = 0; i < n; ++i){
	 	cin >> c >> k;
	 	if(c == 'H'){
	 	 	msy.insert(k);
	 	 	int last = *(msy.upb(k)) - *(--msy.lwb(k));
	 	 	//cout << last ;
	 	 	//return 0;
	 	 	int res1 = *(msy.lwb(k)) - *(--msy.lwb(k));
	 	 	int res2 = *(msy.upb(k)) - *(msy.lwb(k));
	 	 	//cout << res1 << " " << res2;
	 	 	//return 0;
	 	 	msdy.erase(msdy.find(last));
	 	 	msdy.insert(res1);
	 	 	msdy.insert(res2);
	 	}
	 	else{
	 		//cout << 1 << en;
	 	 	msx.insert(k);
	 	 	//cout << 1 << en;
	 	 	int last = *(msx.upb(k)) - *(--msx.lwb(k));
	 	 	int res1 = *(msx.lwb(k)) - *(--msx.lwb(k));
	 	 	int res2 = *(msx.upb(k)) - *(msx.lwb(k));
	 	 	//cout << 1 << en;
	 	 	//cout << last << en;
	 	 	msdx.erase(msdx.find(last));
	 	 	//cout << 1 << en;
	 	 	msdx.insert(res1);
	 	 	msdx.insert(res2);
	 	}
	 	cout <<( *(msdy.rbegin())) * (*(msdx.rbegin())) << en;
	}
}


#include <algorithm>
#include <array>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <list>
#include <numeric>
#include <string>
#include <type_traits>
#include <unistd.h>
#include <vector>

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

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

    array<size_t, 200000> hor = {0};
    array<size_t, 200000> vert = {0};
    for (size_t i = 0; i < n; ++i) {
        char c;
        int coord;
        cin >> c >> coord;
        if (c == 'H') {
            hor[coord] = i + 1;
        } else {
            vert[coord] = i + 1;
        }
    }

    list<int> vert_seg, hor_seg;
    vector<pair<bool, decltype(hor_seg)::iterator>> cut_iter(n);
    int len = 0;
    for (int i = 0; i < h; ++i) {
        if (hor[i] != 0) {
            hor_seg.emplace_back(len);
            cut_iter[hor[i] - 1] = {false, prev(end(hor_seg))};
            len = 0;
        }

        ++len;
    }
    hor_seg.emplace_back(len);

    len = 0;
    for (int i = 0; i < w; ++i) {
        if (vert[i] != 0) {
            vert_seg.emplace_back(len);
            cut_iter[vert[i] - 1] = {true, prev(end(vert_seg))};
            len = 0;
        }

        ++len;
    }
    vert_seg.emplace_back(len);

    int max_vert = *max_element(begin(vert_seg), end(vert_seg));
    int max_hor = *max_element(begin(hor_seg), end(hor_seg));

    vector<int64_t> result(n);
    for (int i = n - 1; i >= 0; --i) {
        result[i] = max_vert * max_hor;

        auto [vert, it] = cut_iter[i];
        if (vert) {
            *next(it) += *it;
            max_vert = max(max_vert, *next(it));
            vert_seg.erase(it);
        } else {
            *next(it) += *it;
            max_hor = max(max_hor, *next(it));
            hor_seg.erase(it);
        }
    }

    for (auto r : result) {
        cout << r << '\n';
    }

    return 0;
}


#include <algorithm>
#include <array>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <type_traits>
#include <unistd.h>
#include <vector>

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

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

    set<int> vert = {h};
    set<int> hor = {w};
    map<int, int> vert_sizes = {{h, 1}};
    map<int, int> hor_sizes = {{w, 1}};

    while (n--) {
        char c;
        int coord;
        cin >> c >> coord;
        if (c == 'H') {
            auto it = lower_bound(begin(vert), end(vert), coord);
            auto high = *it;
            auto low = it == begin(vert) ? 0 : *prev(it);
            vert.emplace_hint(it, coord);
            auto it2 = vert_sizes.find(high - low);
            if (it2->second > 1) {
                it2->second--;
            } else {
                vert_sizes.erase(it2);
            }
            vert_sizes[high - coord]++;
            vert_sizes[coord - low]++;
        } else {
            auto it = lower_bound(begin(hor), end(hor), coord);
            auto high = *it;
            auto low = it == begin(hor) ? 0 : *prev(it);
            hor.emplace_hint(it, coord);
            auto it2 = hor_sizes.find(high - low);
            if (it2->second > 1) {
                it2->second--;
            } else {
                hor_sizes.erase(it2);
            }
            hor_sizes[high - coord]++;
            hor_sizes[coord - low]++;
        }

        cout << (prev(end(vert_sizes))->first * prev(end(hor_sizes))->first) << '\n';
    }

    return 0;
}


#include <algorithm>
#include <array>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <numeric>
#include <set>
#include <string>
#include <type_traits>
#include <unistd.h>
#include <vector>

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

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

    set<int> vert = {h};
    set<int> hor = {w};
    multiset<int> vert_sizes = {h};
    multiset<int> hor_sizes = {w};

    while (n--) {
        char c;
        int coord;
        cin >> c >> coord;
        if (c == 'H') {
            auto it = lower_bound(begin(vert), end(vert), coord);
            auto high = *it;
            auto low = it == begin(vert) ? 0 : *prev(it);
            vert.emplace_hint(it, coord);
            vert_sizes.erase(vert_sizes.find(high - low));
            vert_sizes.emplace(high - coord);
            vert_sizes.emplace(coord - low);
        } else {
            auto it = lower_bound(begin(hor), end(hor), coord);
            auto high = *it;
            auto low = it == begin(hor) ? 0 : *prev(it);
            hor.emplace_hint(it, coord);
            hor_sizes.erase(hor_sizes.find(high - low));
            hor_sizes.emplace(high - coord);
            hor_sizes.emplace(coord - low);
        }

        cout << (*prev(end(vert_sizes)) * *prev(end(hor_sizes))) << '\n';
    }

    return 0;
}


#include <algorithm>
#include <array>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <list>
#include <numeric>
#include <string>
#include <type_traits>
#include <unistd.h>
#include <vector>

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

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

    array<size_t, 200000> hor = {0};
    array<size_t, 200000> vert = {0};
    for (size_t i = 0; i < n; ++i) {
        char c;
        int coord;
        cin >> c >> coord;
        if (c == 'H') {
            hor[coord] = i + 1;
        } else {
            vert[coord] = i + 1;
        }
    }

    list<int> vert_seg, hor_seg;
    vector<pair<bool, decltype(hor_seg)::iterator>> cut_iter(n);
    int len = 0;
    for (int i = 0; i < h; ++i) {
        if (hor[i] != 0) {
            hor_seg.emplace_back(len);
            cut_iter[hor[i] - 1] = {false, prev(end(hor_seg))};
            len = 0;
        }

        ++len;
    }
    hor_seg.emplace_back(len);

    len = 0;
    for (int i = 0; i < w; ++i) {
        if (vert[i] != 0) {
            vert_seg.emplace_back(len);
            cut_iter[vert[i] - 1] = {true, prev(end(vert_seg))};
            len = 0;
        }

        ++len;
    }
    vert_seg.emplace_back(len);

    int max_vert = *max_element(begin(vert_seg), end(vert_seg));
    int max_hor = *max_element(begin(hor_seg), end(hor_seg));

    vector<int64_t> result(n);
    for (int i = n - 1; i >= 0; --i) {
        result[i] = (int64_t)max_vert * max_hor;

        auto [vert, it] = cut_iter[i];
        if (vert) {
            *next(it) += *it;
            max_vert = max(max_vert, *next(it));
            vert_seg.erase(it);
        } else {
            *next(it) += *it;
            max_hor = max(max_hor, *next(it));
            hor_seg.erase(it);
        }
    }

    for (auto r : result) {
        cout << r << '\n';
    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int h,w,n;
    cin>>h>>w>>n;
    set<int> s1,s2;
    multiset<int> s3,s4;
    s1.insert(0);
    s1.insert(h);
    s2.insert(w);
    s2.insert(0);
    s3.insert(h);
    s4.insert(w);
    for(int i = 0;i<n;i++)
    {
        int v;
        char c;
        cin>>c>>v;
        if(c=='V')
        {
            set<int>::iterator it1 = (s1.insert(v)).first;
            set<int>::iterator it3 = it1,it4 = it1;
            it3++;
            it4--;
            s3.insert(*(it3)-(*it1));
            s3.insert(*(it1)-(*it4));
            multiset<int>::iterator hit(s3.find((*it3)-(*it4)));
            if (hit!= s3.end()) s3.erase(hit);
            //for(multiset<int>::iterator it = s3.begin();it!=s3.end();it++)
              //  cout<<(*it)<<" ";
            //cout<<endl;
        }
        else
        {
            set<int>::iterator it2 = (s2.insert(v)).first;
            set<int>::iterator it5 = it2,it6 = it2;
            it5++;
            it6--;
            s4.insert(*(it5)-(*it2));
            s4.insert(*(it2)-(*it6));
            //s4.erase(*(it5)-(*it6));
            multiset<int>::iterator hit(s4.find(*(it5)-(*it6)));
            if (hit!= s4.end()) s4.erase(hit);
            //for(multiset<int>::iterator it = s4.begin();it!=s4.end();it++)
              //  cout<<(*it)<<" ";
            //cout<<endl;
        }
        unsigned long long int a = (*s3.rbegin()), b = (*s4.rbegin());
        cout<<a*b<<endl;;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int h,w,n;
    cin>>h>>w>>n;
    set<int> s1,s2;
    multiset<int> s3,s4;
    s1.insert(0);
    s1.insert(h);
    s2.insert(w);
    s2.insert(0);
    s3.insert(h);
    s4.insert(w);
    for(int i = 0;i<n;i++)
    {
        int v;
        char c;
        cin>>c>>v;
        if(c=='V')
        {
            set<int>::iterator it1 = (s1.insert(v)).first;
            set<int>::iterator it3 = it1,it4 = it1;
            it3++;
            it4--;
            s3.insert(*(it3)-(*it1));
            s3.insert(*(it1)-(*it4));
            multiset<int>::iterator hit(s3.find((*it3)-(*it4)));
            if (hit!= s3.end()) s3.erase(hit);
            //for(multiset<int>::iterator it = s3.begin();it!=s3.end();it++)
              //  cout<<(*it)<<" ";
            //cout<<endl;
        }
        else
        {
            set<int>::iterator it2 = (s2.insert(v)).first;
            set<int>::iterator it5 = it2,it6 = it2;
            it5++;
            it6--;
            s4.insert(*(it5)-(*it2));
            s4.insert(*(it2)-(*it6));
            //s4.erase(*(it5)-(*it6));
            multiset<int>::iterator hit(s4.find(*(it5)-(*it6)));
            if (hit!= s4.end()) s4.erase(hit);
            //for(multiset<int>::iterator it = s4.begin();it!=s4.end();it++)
              //  cout<<(*it)<<" ";
            //cout<<endl;
        }
        cout<<(*s3.rbegin())*(*s4.rbegin())<<endl;;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int h,w,n;
    cin>>h>>w>>n;
    set<int> s1,s2;
    multiset<int> s3,s4;
    s1.insert(0);
    s1.insert(h);
    s2.insert(w);
    s2.insert(0);
    s3.insert(h);
    s4.insert(w);
    for(int i = 0;i<n;i++)
    {
        int v;
        char c;
        cin>>c>>v;
        if(c=='V')
        {
            set<int>::iterator it1 = (s1.insert(v)).first;
            set<int>::iterator it3 = it1,it4 = it1;
            it3++;
            it4--;
            s3.insert(*(it3)-(*it1));
            s3.insert(*(it1)-(*it4));
            multiset<int>::iterator hit(s3.find((*it3)-(*it4)));
            if (hit!= s3.end()) s3.erase(hit);
            //for(multiset<int>::iterator it = s3.begin();it!=s3.end();it++)
              //  cout<<(*it)<<" ";
            //cout<<endl;
        }
        else
        {
            set<int>::iterator it2 = (s2.insert(v)).first;
            set<int>::iterator it5 = it2,it6 = it2;
            it5++;
            it6--;
            s4.insert(*(it5)-(*it2));
            s4.insert(*(it2)-(*it6));
            s4.erase(*(it5)-(*it6));
            multiset<int>::iterator hit(s4.find(*(it5)-(*it6)));
            if (hit!= s4.end()) s4.erase(hit);
            //for(multiset<int>::iterator it = s4.begin();it!=s4.end();it++)
              //  cout<<(*it)<<" ";
            //cout<<endl;
        }
        cout<<(*s3.rbegin())*(*s4.rbegin())<<endl;;
    }
    return 0;
}


#include<bits/stdc++.h>

using namespace std;
typedef long long int ll;

set <int> v;
set <int> h;
multiset <int> v1;
multiset <int> h1;
int n;
int t, a;

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> t >> a;
	cin >> n;
	v.insert(0);
	h.insert(0);
	v.insert(t);
	h.insert(a);
	v1.insert(t);
	h1.insert(a);
	char ord;
	int num;
	while(n--)
	{
		cin >> ord >> num;
		if(ord == 'V')
		{
			set <int> :: iterator it = v.upper_bound(num);
			int nxt, prv;
			nxt = *(it);
			it--;
			prv = *(it);
			v.insert(num);
			v1.erase(v1.lower_bound(nxt - prv));
			v1.insert(num - prv);
			v1.insert(nxt - num);
		}
		else
		{
			set <int> :: iterator it = h.upper_bound(num);
			int nxt, prv;
			nxt = *(it);
			it--;
			prv = *(it);
			h.insert(num);
			h1.erase(h1.lower_bound(nxt - prv));
			h1.insert(num - prv);
			h1.insert(nxt - num);
		}
		multiset <int> :: iterator mxv = v1.end(), mxh = h1.end();
		mxv--;
		mxh--;
		cout << (ll)*(mxv) * (ll)*(mxh) << '\n';
	}
	return 0;
}


#include<bits/stdc++.h>

using namespace std;
typedef long long int ll;

set <int> v;
set <int> h;
multiset <int> v1;
multiset <int> h1;
int n;
int t, a;

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> t >> a;
	cin >> n;
	v.insert(0);
	h.insert(0);
	v.insert(t);
	h.insert(a);
	v1.insert(t);
	h1.insert(a);
	char ord;
	int num;
	for(int i = 0; i < n; i++)
	{
		cin >> ord >> num;
		if(ord == 'V')
		{
			set <int> :: iterator it = upper_bound(v.begin(), v.end(), num);
			int nxt, prv;
			nxt = *(it);
			it--;
			prv = *(it);
			v.insert(num);
			v1.erase(lower_bound(v1.begin(), v1.end(), (nxt - prv)));
			v1.insert(num - prv);
			v1.insert(nxt - num);
		}
		else
		{
			set <int> :: iterator it = upper_bound(h.begin(), h.end(), num);
			int nxt, prv;
			nxt = *(it);
			it--;
			prv = *(it);
			h.insert(num);
			h1.erase(lower_bound(h1.begin(), h1.end(), (nxt - prv)));
			h1.insert(num - prv);
			h1.insert(nxt - num);
		}
		multiset <int> :: iterator mxv = v1.end(), mxh = h1.end();
		mxv--;
		mxh--;
		cout << (ll)*(mxv) * (ll)*(mxh) << endl;
	}
	return 0;
}


#include<bits/stdc++.h>

using namespace std;
typedef long long int ll;

set <int> v;
set <int> h;
multiset <int> v1;
multiset <int> h1;
int n;
int t, a;

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> t >> a;
	cin >> n;
	v.insert(0);
	h.insert(0);
	v.insert(t);
	h.insert(a);
	v1.insert(t);
	h1.insert(a);
	char ord;
	int num;
	while(n--)
	{
		cin >> ord >> num;
		if(ord == 'V')
		{
			set <int> :: iterator it = upper_bound(v.begin(), v.end(), num);
			int nxt, prv;
			nxt = *(it);
			it--;
			prv = *(it);
			v.insert(num);
			v1.erase(lower_bound(v1.begin(), v1.end(), (nxt - prv)));
			v1.insert(num - prv);
			v1.insert(nxt - num);
		}
		else
		{
			set <int> :: iterator it = upper_bound(h.begin(), h.end(), num);
			int nxt, prv;
			nxt = *(it);
			it--;
			prv = *(it);
			h.insert(num);
			h1.erase(lower_bound(h1.begin(), h1.end(), (nxt - prv)));
			h1.insert(num - prv);
			h1.insert(nxt - num);
		}
		multiset <int> :: iterator mxv = v1.end(), mxh = h1.end();
		mxv--;
		mxh--;
		cout << (ll)*(mxv) * (ll)*(mxh) << '\n';
	}
	return 0;
}


#include<bits/stdc++.h>

using namespace std;
typedef long long int ll;

set <ll> v;
set <ll> h;
set <pair <ll, ll>> v1;
set <pair <ll, ll>> h1;
int n;
ll t, a;

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> t >> a;
	cin >> n;
	v.insert(0);
	h.insert(0);
	v.insert(t);
	h.insert(a);
	pair <ll, ll> p(t, 0);
	v1.insert(p);
	p.first = a;
	h1.insert(p);
	char ord;
	ll num;
	for(int i = 0; i < n; i++)
	{
		cin >> ord >> num;
		if(ord == 'V')
		{
			set <ll> :: iterator it = upper_bound(v.begin(), v.end(), num);
			ll nxt = *(it);
			it--;
			ll prv = *(it);
			p.first = nxt - prv;
			p.second = prv;
			v1.erase(p);
			p.first = num - prv;
			v1.insert(p);
			p.first = nxt - num;
			p.second = num;
			v1.insert(p);
			v.insert(num);
			set <pair<ll, ll>> :: iterator it2 = v1.end();
			it2--;
			prv = it2->first;
			it2 = h1.end();
			it2--;
			nxt = it2->first;
			cout << nxt * prv << endl;
		}
		else
		{
			set <ll> :: iterator it = upper_bound(h.begin(), h.end(), num);
			ll nxt = *(it);
			it--;
			ll prv = *(it);
			p.first = nxt - prv;
			p.second = prv;
			h1.erase(p);
			p.first = num - prv;
			h1.insert(p);
			p.first = nxt - num;
			p.second = num;
			h1.insert(p);
			h.insert(num);
			set <pair<ll, ll>> :: iterator it2 = h1.end();
			it2--;
			prv = it2->first;
			it2 = v1.end();
			it2--;
			nxt = it2->first;
			cout << nxt * prv << endl;
		}
	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

struct classcomp {
  bool operator() (const long long& lhs, const long long& rhs) const
  {return lhs>rhs;}
};

set<long long> x, y;
multiset<long long, classcomp> difx, dify;

int main() {
    long long w, h, n;
    cin>>w>>h>>n;
    x.insert(w);
    x.insert(0);
    y.insert(h);
    y.insert(0);
    difx.insert(w);
    dify.insert(h);
    for( int i = 1; i <= n; i ++ ) {
      char ch;
      long long a;
      cin>>ch>>a;
      if( ch == 'V' ) {
        auto it1 = x.lower_bound(a);
        auto it2 = x.upper_bound(a);
        -- it1;
        auto it3 = difx.find(*it2 - *it1);
        difx.erase(it3);
        difx.insert(*it2 - a);
        difx.insert(a - *it1);
        x.insert(a);
      }
      else {
        auto it1 = y.lower_bound(a);
        auto it2 = y.upper_bound(a);
        -- it1;
        auto it3 = dify.find(*it2 - *it1);
        dify.erase(it3);
        dify.insert(*it2 - a);
        dify.insert(a - *it1);
        y.insert(a);
      }

      auto it1 = difx.begin();
      auto it2 = dify.begin();

      cout<<(*it1)*(*it2)<<"\n";
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

struct classcomp {
  bool operator() (const int& lhs, const int& rhs) const
  {return lhs>rhs;}
};

set<int> x, y;
multiset<int, classcomp> difx, dify;

int main() {
    int w, h, n;
    cin>>w>>h>>n;
    x.insert(w);
    x.insert(0);
    y.insert(h);
    y.insert(0);
    difx.insert(w);
    dify.insert(h);
    for( int i = 1; i <= n; i ++ ) {
      char ch;
      int a;
      cin>>ch>>a;
      if( ch == 'V' ) {
        auto it1 = x.lower_bound(a);
        auto it2 = x.upper_bound(a);
        -- it1;
        auto it3 = difx.find(*it2 - *it1);
        difx.erase(it3);
        difx.insert(*it2 - a);
        difx.insert(a - *it1);
        x.insert(a);
      }
      else {
        auto it1 = y.lower_bound(a);
        auto it2 = y.upper_bound(a);
        -- it1;
        auto it3 = dify.find(*it2 - *it1);
        dify.erase(it3);
        dify.insert(*it2 - a);
        dify.insert(a - *it1);
        y.insert(a);
      }

      auto it1 = difx.begin();
      auto it2 = dify.begin();

      cout<<(*it1)*(*it2)<<"\n";
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

struct classcomp {
  bool operator() (const int& lhs, const int& rhs) const
  {return lhs>rhs;}
};

set<int> x, y;
multiset<int, classcomp> difx, dify;

int main() {
    int w, h, n;
    cin>>w>>h>>n;
    x.insert(w);
    x.insert(0);
    y.insert(h);
    y.insert(0);
    difx.insert(w);
    dify.insert(h);
    for( int i = 1; i <= n; i ++ ) {
      char ch;
      int a;
      cin>>ch>>a;
      if( ch == 'V' ) {
        auto it1 = x.lower_bound(a);
        auto it2 = x.upper_bound(a);
        -- it1;
        difx.erase(*it2 - *it1);
        difx.insert(*it2 - a);
        difx.insert(a - *it1);
        x.insert(a);
      }
      else {
        auto it1 = y.lower_bound(a);
        auto it2 = y.upper_bound(a);
        -- it1;
        dify.erase(*it2 - *it1);
        dify.insert(*it2 - a);
        dify.insert(a - *it1);
        y.insert(a);
      }

      auto it1 = difx.begin();
      auto it2 = dify.begin();

      cout<<(*it1) * (*it2)<<"\n";
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const ll MAXN = 1e2 + 5;
const ll MAXD = 1e4 + 5;
const ll MOD = 1e9 + 7;
const long double EPS = 1e-4;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline ll rand(ll a, ll b) {ll c = rng(); return a+((ll)abs(c))%(b-a+1);}

int main(){

        ios::sync_with_stdio(0);
        cin.tie(0);
        ll w,h,n;
        cin >> w >> h >> n;
        set<ll> sw,sh;
        sw.insert(w);
        sh.insert(h);
        multiset<ll> maxw , maxh;
        maxh.insert(h);
        maxw.insert(w);

        while(n--)
        {
            char c;
            ll x;
            cin >> c >> x;
            if(c == 'H')
            {
                multiset<ll> ::iterator it;
                it = sh.lower_bound(x);
                ll lh , rh;
                rh = *it;
                if(it == sh.begin())
                    lh = 0;
                else
                 {
                    --it;
                    lh = *it;
                 }

                 sh.insert(x);
                 if(maxh.find(abs(rh - lh)) != maxh.end());
                   maxh.erase(maxh.find(abs(rh - lh)));
                 maxh.insert(abs(rh - x));
                 maxh.insert(abs(x - lh));

            }

            else
            {
                multiset<ll> ::iterator it;
                it = sw.lower_bound(x);
                ll lw , rw;
                rw = *it;
                if(it == sw.begin())
                    lw = 0;
                else
                 {
                    --it;
                    lw = *it;
                 }

                 sw.insert(x);
                // cout << "TEST --------- " << rw - lw << '\n';
                 if(maxw.find(abs(rw - lw)) != maxw.end())
                     maxw.erase(maxw.find(abs(rw - lw)));

                //cout << rw - x << ' ' << x - lw << '\n';
                 maxw.insert(abs(rw - x));
                 maxw.insert(abs(x - lw));
            }

            multiset<ll> ::iterator it1,it2;
            it1 = maxh.end();
            it2 = maxw.end();
            --it1;
            --it2;
           // cout << (*it2) << ' ' <<  (*it1) << '\n';
           cout << (ll) ((*it2) * (*it1)) << '\n';
           // return 0;

        }

}


#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const ll MAXN = 1e2 + 5;
const ll MAXD = 1e4 + 5;
const ll MOD = 1e9 + 7;
const long double EPS = 1e-4;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline ll rand(ll a, ll b) {ll c = rng(); return a+((ll)abs(c))%(b-a+1);}

int main(){

        ios::sync_with_stdio(0);
        cin.tie(0);
        int w,h,n;
        cin >> w >> h >> n;
        set<int> sw,sh;
        sw.insert(w);
        sh.insert(h);
        multiset<int> maxw , maxh;
        maxh.insert(h);
        maxw.insert(w);

        while(n--)
        {
            char c;
            int x;
            cin >> c >> x;
            if(c == 'H')
            {
                multiset<int> ::iterator it;
                it = sh.lower_bound(x);
                int lh , rh;
                rh = *it;
                if(it == sh.begin())
                    lh = 0;
                else
                 {
                    --it;
                    lh = *it;
                 }

                 sh.insert(x);
                 if(maxh.find(abs(rh - lh)) != maxh.end());
                   maxh.erase(maxh.find(abs(rh - lh)));
                 maxh.insert(abs(rh - x));
                 maxh.insert(abs(x - lh));

            }

            else
            {
                multiset<int> ::iterator it;
                it = sw.lower_bound(x);
                int lw , rw;
                rw = *it;
                if(it == sw.begin())
                    lw = 0;
                else
                 {
                    --it;
                    lw = *it;
                 }

                 sw.insert(x);
                // cout << "TEST --------- " << rw - lw << '\n';
                 if(maxw.find(abs(rw - lw)) != maxw.end())
                     maxw.erase(maxw.find(abs(rw - lw)));

                //cout << rw - x << ' ' << x - lw << '\n';
                 maxw.insert(abs(rw - x));
                 maxw.insert(abs(x - lw));
            }

            multiset<int> ::iterator it1,it2;
            it1 = maxh.end();
            it2 = maxw.end();
            --it1;
            --it2;
           // cout << (*it2) << ' ' <<  (*it1) << '\n';
           cout << (ll) ((*it2) * (*it1)) << '\n';
           // return 0;

        }

}


#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const ll MAXN = 1e2 + 5;
const ll MAXD = 1e4 + 5;
const ll MOD = 1e9 + 7;
const long double EPS = 1e-4;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline ll rand(ll a, ll b) {ll c = rng(); return a+((ll)abs(c))%(b-a+1);}

int main(){

        ios::sync_with_stdio(0);
        cin.tie(0);
        int w,h,n;
        cin >> w >> h >> n;
        set<int> sw,sh;
        sw.insert(w);
        sh.insert(h);
        multiset<int> maxw , maxh;
        maxh.insert(h);
        maxw.insert(w);

        while(n--)
        {
            char c;
            int x;
            cin >> c >> x;
            if(c == 'H')
            {
                multiset<int> ::iterator it;
                it = sh.lower_bound(x);
                int lh , rh;
                rh = *it;
                if(it == sh.begin())
                    lh = 0;
                else
                 {
                    --it;
                    lh = *it;
                 }

                 sh.insert(x);
                 if(maxh.count(abs(rh - lh)));
                   maxh.erase(maxh.find(abs(rh - lh)));
                 maxh.insert(abs(rh - x));
                 maxh.insert(abs(x - lh));

            }

            else
            {
                multiset<int> ::iterator it;
                it = sw.lower_bound(x);
                int lw , rw;
                rw = *it;
                if(it == sw.begin())
                    lw = 0;
                else
                 {
                    --it;
                    lw = *it;
                 }

                 sw.insert(x);
                // cout << "TEST --------- " << rw - lw << '\n';
                 if(maxw.count(abs(rw - lw)))
                     maxw.erase(maxw.find(abs(rw - lw)));

                //cout << rw - x << ' ' << x - lw << '\n';
                 maxw.insert(abs(rw - x));
                 maxw.insert(abs(x - lw));
            }

            multiset<int> ::iterator it1,it2;
            it1 = maxh.end();
            it2 = maxw.end();
            --it1;
            --it2;
           // cout << (*it2) << ' ' <<  (*it1) << '\n';
           cout << (*it2) * (*it1) << '\n';
           // return 0;

        }

}


#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const ll MAXN = 1e2 + 5;
const ll MAXD = 1e4 + 5;
const ll MOD = 1e9 + 7;
const long double EPS = 1e-4;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline ll rand(ll a, ll b) {ll c = rng(); return a+((ll)abs(c))%(b-a+1);}

int main(){

        ios::sync_with_stdio(0);
        cin.tie(0);
        int w,h,n;
        cin >> w >> h >> n;
        set<int> sw,sh;
        sw.insert(w);
        sh.insert(h);
        multiset<int> maxw , maxh;
        maxh.insert(h);
        maxw.insert(w);

        while(n--)
        {
            char c;
            int x;
            cin >> c >> x;
            if(c == 'H')
            {
                multiset<int> ::iterator it;
                it = sh.lower_bound(x);
                int lh , rh;
                rh = *it;
                if(it == sh.begin())
                    lh = 0;
                else
                 {
                    --it;
                    lh = *it;
                 }

                 sh.insert(x);
                 if(maxh.find(abs(rh - lh)) != maxh.end());
                   maxh.erase(maxh.find(abs(rh - lh)));
                 maxh.insert(abs(rh - x));
                 maxh.insert(abs(x - lh));

            }

            else
            {
                multiset<int> ::iterator it;
                it = sw.lower_bound(x);
                int lw , rw;
                rw = *it;
                if(it == sw.begin())
                    lw = 0;
                else
                 {
                    --it;
                    lw = *it;
                 }

                 sw.insert(x);
                // cout << "TEST --------- " << rw - lw << '\n';
                 if(maxw.find(abs(rw - lw)) != maxw.end())
                     maxw.erase(maxw.find(abs(rw - lw)));

                //cout << rw - x << ' ' << x - lw << '\n';
                 maxw.insert(abs(rw - x));
                 maxw.insert(abs(x - lw));
            }

            multiset<int> ::iterator it1,it2;
            it1 = maxh.end();
            it2 = maxw.end();
            --it1;
            --it2;
           // cout << (*it2) << ' ' <<  (*it1) << '\n';
           cout << (*it2) * (*it1) << '\n';
           // return 0;

        }

}


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

// clang-format off
#define int long long
#define dout if(debug and (debug_test == 0 or _t == debug_test) ) cerr<<" "
#define endl "\n";cout.flush()
#ifdef ONLINE_JUDGE
#define DEBUG 0.0
#else
#define DEBUG 1
#endif
int debug = DEBUG;// it will take care of itself on online-judge
int debug_test = 0; // test_case to be debugged ... 0 means all ... -1 means none
int _t = 0;// test_case counter

typedef unsigned long long ulli;// rarely will be used
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef set<int> si;
template<class A,class B> using umap = unordered_map<A,B>;
template<class A,class B> using pqueue = priority_queue<A,vector<A>,B>;
typedef vector<vector<int>> matrix; // matrix matt(n,vector<int>(m,0));
#define dmatrix(n,m) matrix(n,vector<int>(m,0)) // to define matrix use dmatrix(n,m)
#define substring(i,j) substr(i,(j-i+1)) // both i,j are included
#define all(container) container.begin(),container.end()
#define FF first
#define SS second
#define TP template
#define IND if(!debug)return

TP<class T>void show(T &first){IND;dout<<first<<"\n";}
TP<class T,class... Args>void show(T &first,Args&... args){IND;dout<<first;show(args...);}
TP<class T>void _p(T &x){IND;int i=0;for(auto a: x){dout<<a<<",";if(i++ > 20)break;}}

TP<class T>ostream &operator<<(ostream &os,vector<T> &x){dout<<"[";_p(x);dout<<"] ";return os;}
TP<class T>ostream &operator<<(ostream &os,set<T> &x){dout<<"{";_p(x);dout<< "} ";return os;}
TP<class T>ostream &operator<<(ostream &os,multiset<T> &x){dout<<"{";_p(x);dout<< "} ";return os;}
TP<class T,class U>ostream &operator<<(ostream &o,pair<T,U> &x){dout<<"("<<x.FF<<","<<x.SS<<")";return o;}
TP<class T,class U>ostream &operator<<(ostream &os,map<T,U> &x){dout<<"[";_p(x);dout<< "] ";return os;}

TP<class T>int sz(T &x){return (int)x.size();}
TP<class T>bool sort_fun(T a,T b){return a>b;} // for desc sort // default sort is asc, use <() fxn
TP<class T,class U>bool found(T t,U u){if(t.find(u)==t.end())return false;return true;}
struct Desc{bool operator()(int a,int b){return a>b;}}desc; // for descending sort
struct AscPQ{bool operator()(int a,int b){return a>b;}}; // for ascending PQ, does descending by default

const int mod = 1e9+7, inf = ((1LL<<((sizeof mod)*8-2))-1)<<1|1, none = inf/2-9;// inf is self adjustable
int add(int x,int y){int res=(x+y)%mod;return res<0?res+mod:res;}
int mul(int x,int y){int res=(x*1LL*y)%mod;return res<0?res+mod:res;}
int dx[] = {0,1,0,-1,1,1,-1,-1},dy[] = {1,0,-1,0,1,-1,-1,1};// use 0-3 for 4dir 0-7 for 8dir
// clang-format off

// code begins here

void solve()
{
    int n,m,q;
    cin>>n>>m>>q;
    set<pii> ha,va;
    multiset<int> hs,vs;
    ha.insert({0,n-1});
    va.insert({0,m-1});
    hs.insert(n);
    vs.insert(m);
    show(ha);
    show("hello",ha);
    show("hello","done",ha);
    show("hello");

    while(q--) {
        char t;int w; cin>>t>>w;
        if(t=='V') {
            pii who = *(--ha.lower_bound({w,1}));
            if(who.SS == w-1) {
            } else {
                pii ll = pii(who.FF,w-1);
                pii rr = pii(w,who.SS);
                ha.erase(who);
                ha.insert(ll);
                ha.insert(rr);
                hs.erase(hs.find(who.SS-who.FF+1));
                hs.insert(ll.SS-ll.FF+1);
                hs.insert(rr.SS-rr.FF+1);
                show(hs,vs);
            }
        } else {
            pii who = *(--va.lower_bound({w,1}));
            if(who.SS == w-1) {
            } else {
                pii ll = pii(who.FF,w-1);
                pii rr = pii(w,who.SS);
                va.erase(who);
                va.insert(ll);
                va.insert(rr);
                vs.erase(vs.find(who.SS-who.FF+1));
                vs.insert(ll.SS-ll.FF+1);
                vs.insert(rr.SS-rr.FF+1);
                show(hs,vs);
            }
        }
        show(hs,vs);
        cout << *hs.rbegin() * *vs.rbegin() << endl;
    }

}

void preprocess()
{

}

signed main()
{
    #ifdef ONLINE_JUDGE
    ios_base::sync_with_stdio(0);cin.tie(0);
    #else
    //freopen("Input.txt","r",stdin);
    #endif
    std::cout << std::fixed; std::cout.precision(7);
    preprocess();
    int test=1;
    //cin>>test;
    for(int t = 1; t <= test; t++)_t = t,solve();
}
// a code by srbcheema1

// https://codeforces.com/contest/527/problem/C


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

// clang-format off
#define int long long
#define dout if(debug and (debug_test == 0 or _t == debug_test) ) cerr<<" "
#define endl "\n";cout.flush()
#ifdef ONLINE_JUDGE
#define DEBUG 0.0
#else
#define DEBUG 1
#endif
int debug = DEBUG;// it will take care of itself on online-judge
int debug_test = 0; // test_case to be debugged ... 0 means all ... -1 means none
int _t = 0;// test_case counter

template<class T>void show(T first){dout<<first<<"\n";}
template<class T,class... Args>void show(T first,Args... args){dout<<first;show(args...);}
#define trace(...) _s(#__VA_ARGS__, __VA_ARGS__)
template<class T>void _s(const char* c,T& first){dout<<c<<" : "<<first<<"\n";}
template<class T,class... Args>void _s(const char *c,T first,Args... args)
{const char* t=strchr(c+1,',');dout;if(debug)cerr.write(c,t-c)<<" : "<<first<< " |";_s(t+1,args...);}
template<class T>void _p(T x){int i=0;for(auto a: x){dout<<a<<",";if(i++ > 20)break;}}
template<class T,class U>ostream &operator<<(ostream &o,pair<T,U> &x){return o<<"("<<x.first<<","<<x.second<<")";}
template<class T>ostream &operator<<(ostream &os,vector<T> &x){dout<<"[";_p(x);dout<<"] ";return os;}
template<class T>ostream &operator<<(ostream &os,set<T> &x){dout<<"{";_p(x);dout<< "} ";return os;}
template<class T>ostream &operator<<(ostream &os,multiset<T> &x){dout<<"{";_p(x);dout<< "} ";return os;}
template<class T,class U>ostream &operator<<(ostream &os,map<T,U> &x){dout<<"[";_p(x);dout<< "] ";return os;}

typedef unsigned long long ulli;// rarely will be used
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef set<int> si;
template<class A,class B> using umap = unordered_map<A,B>;
template<class A,class B> using pqueue = priority_queue<A,vector<A>,B>;
typedef vector<vector<int>> matrix; // matrix matt(n,vector<int>(m,0));
#define dmatrix(n,m) matrix(n,vector<int>(m,0)) // to define matrix use dmatrix(n,m)
#define substring(i,j) substr(i,(j-i+1)) // both i,j are included
#define all(container) container.begin(),container.end()
#define FF first
#define SS second

template<class T>int sz(T &x){return (int)x.size();}
template<class T>bool sort_fun(T a,T b){return a>b;} // for desc sort // default sort is asc, use <() fxn
template<class T,class U>bool found(T t,U u){if(t.find(u)==t.end())return false;return true;}
struct Desc{bool operator()(int a,int b){return a>b;}}desc; // for descending sort
struct AscPQ{bool operator()(int a,int b){return a>b;}}; // for ascending PQ, does descending by default

const int mod = 1e9+7, inf = ((1LL<<((sizeof mod)*8-2))-1)<<1|1, none = inf/2-9;// inf is self adjustable
int add(int x,int y){int res=(x+y)%mod;return res<0?res+mod:res;}
int mul(int x,int y){int res=(x*1LL*y)%mod;return res<0?res+mod:res;}
int dx[] = {0,1,0,-1,1,1,-1,-1},dy[] = {1,0,-1,0,1,-1,-1,1};// use 0-3 for 4dir 0-7 for 8dir
// clang-format off

// code begins here

void solve()
{
    int n,m,q;
    cin>>n>>m>>q;
    set<pii> ha,va;
    multiset<int> hs,vs;
    ha.insert({0,n-1});
    va.insert({0,m-1});
    hs.insert(n);
    vs.insert(m);

    while(q--) {
        char t;int w; cin>>t>>w;
        if(t=='V') {
            pii who = *(--ha.lower_bound({w,1}));
            //show("ha,who",ha,who);
            if(who.SS == w-1) {
            } else {
                pii ll = pii(who.FF,w-1);
                pii rr = pii(w,who.SS);
                ha.erase(who);
                ha.insert(ll);
                ha.insert(rr);
                //show("before deleting ",who.SS-who.FF+1,hs);
                hs.erase(hs.find(who.SS-who.FF+1));
                hs.insert(ll.SS-ll.FF+1);
                hs.insert(rr.SS-rr.FF+1);
                //show("after inserting",hs);
            }
        } else {
            pii who = *(--va.lower_bound({w,1}));
            //show("va,who",va,who);
            if(who.SS == w-1) {
            } else {
                pii ll = pii(who.FF,w-1);
                pii rr = pii(w,who.SS);
                va.erase(who);
                va.insert(ll);
                va.insert(rr);
                vs.erase(vs.find(who.SS-who.FF+1));
                vs.insert(ll.SS-ll.FF+1);
                vs.insert(rr.SS-rr.FF+1);
            }
        }
        //show("hs,vs",hs,vs);
        cout << *hs.rbegin() * *vs.rbegin() << endl;
    }

}

void preprocess()
{

}

signed main()
{
    #ifdef ONLINE_JUDGE
    ios_base::sync_with_stdio(0);cin.tie(0);
    #else
    //freopen("Input.txt","r",stdin);
    #endif
    std::cout << std::fixed; std::cout.precision(7);
    preprocess();
    int test=1;
    //cin>>test;
    for(int t = 1; t <= test; t++)_t = t,solve();
}
// a code by srbcheema1

// https://codeforces.com/contest/527/problem/C


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

// clang-format off
#define int long long
#define dout if(debug and (debug_test == 0 or _t == debug_test) ) cerr<<" "
#define endl "\n";cout.flush()
#ifdef ONLINE_JUDGE
#define DEBUG 0.0
#else
#define DEBUG 1
#endif
int debug = DEBUG;// it will take care of itself on online-judge
int debug_test = 0; // test_case to be debugged ... 0 means all ... -1 means none
int _t = 0;// test_case counter

template<class T>void show(T first){dout<<first<<"\n";}
template<class T,class... Args>void show(T first,Args... args){dout<<first;show(args...);}
#define trace(...) _s(#__VA_ARGS__, __VA_ARGS__)
template<class T>void _s(const char* c,T& first){dout<<c<<" : "<<first<<"\n";}
template<class T,class... Args>void _s(const char *c,T first,Args... args)
{const char* t=strchr(c+1,',');dout;if(debug)cerr.write(c,t-c)<<" : "<<first<< " |";_s(t+1,args...);}
template<class T>void _p(T x){int i=0;for(auto a: x){dout<<a<<",";if(i++ > 20)break;}}
template<class T,class U>ostream &operator<<(ostream &o,pair<T,U> &x){return o<<"("<<x.first<<","<<x.second<<")";}
template<class T>ostream &operator<<(ostream &os,vector<T> &x){dout<<"[";_p(x);dout<<"] ";return os;}
template<class T>ostream &operator<<(ostream &os,set<T> &x){dout<<"{";_p(x);dout<< "} ";return os;}
template<class T>ostream &operator<<(ostream &os,multiset<T> &x){dout<<"{";_p(x);dout<< "} ";return os;}
template<class T,class U>ostream &operator<<(ostream &os,map<T,U> &x){dout<<"[";_p(x);dout<< "] ";return os;}

typedef unsigned long long ulli;// rarely will be used
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef set<int> si;
template<class A,class B> using umap = unordered_map<A,B>;
template<class A,class B> using pqueue = priority_queue<A,vector<A>,B>;
typedef vector<vector<int>> matrix; // matrix matt(n,vector<int>(m,0));
#define dmatrix(n,m) matrix(n,vector<int>(m,0)) // to define matrix use dmatrix(n,m)
#define substring(i,j) substr(i,(j-i+1)) // both i,j are included
#define all(container) container.begin(),container.end()
#define FF first
#define SS second

template<class T>int sz(T &x){return (int)x.size();}
template<class T>bool sort_fun(T a,T b){return a>b;} // for desc sort // default sort is asc, use <() fxn
template<class T,class U>bool found(T t,U u){if(t.find(u)==t.end())return false;return true;}
struct Desc{bool operator()(int a,int b){return a>b;}}desc; // for descending sort
struct AscPQ{bool operator()(int a,int b){return a>b;}}; // for ascending PQ, does descending by default

const int mod = 1e9+7, inf = ((1LL<<((sizeof mod)*8-2))-1)<<1|1, none = inf/2-9;// inf is self adjustable
int add(int x,int y){int res=(x+y)%mod;return res<0?res+mod:res;}
int mul(int x,int y){int res=(x*1LL*y)%mod;return res<0?res+mod:res;}
int dx[] = {0,1,0,-1,1,1,-1,-1},dy[] = {1,0,-1,0,1,-1,-1,1};// use 0-3 for 4dir 0-7 for 8dir
// clang-format off

// code begins here

void solve()
{
    int n,m,q;
    cin>>n>>m>>q;
    set<pii> ha,va;
    multiset<int> hs,vs;
    ha.insert({0,n-1});
    va.insert({0,m-1});
    hs.insert(n);
    vs.insert(m);

    while(q--) {
        char t;int w; cin>>t>>w;
        if(t=='V') {
            pii who = *(--ha.lower_bound({w,1}));
            show("ha,who",ha,who);
            if(who.SS == w-1) {
            } else {
                pii ll = pii(who.FF,w-1);
                pii rr = pii(w,who.SS);
                ha.erase(who);
                ha.insert(ll);
                ha.insert(rr);
                show("before deleting ",who.SS-who.FF+1,hs);
                hs.erase(hs.find(who.SS-who.FF+1));
                hs.insert(ll.SS-ll.FF+1);
                hs.insert(rr.SS-rr.FF+1);
                show("after inserting",hs);
            }
        } else {
            pii who = *(--va.lower_bound({w,1}));
            show("va,who",va,who);
            if(who.SS == w-1) {
            } else {
                pii ll = pii(who.FF,w-1);
                pii rr = pii(w,who.SS);
                va.erase(who);
                va.insert(ll);
                va.insert(rr);
                vs.erase(vs.find(who.SS-who.FF+1));
                vs.insert(ll.SS-ll.FF+1);
                vs.insert(rr.SS-rr.FF+1);
            }
        }
        show("hs,vs",hs,vs);
        cout << *hs.rbegin() * *vs.rbegin() << endl;
    }

}

void preprocess()
{

}

signed main()
{
    #ifdef ONLINE_JUDGE
    ios_base::sync_with_stdio(0);cin.tie(0);
    #else
    //freopen("Input.txt","r",stdin);
    #endif
    std::cout << std::fixed; std::cout.precision(7);
    preprocess();
    int test=1;
    //cin>>test;
    for(int t = 1; t <= test; t++)_t = t,solve();
}
// a code by srbcheema1

// https://codeforces.com/contest/527/problem/C


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

// clang-format off
#define int long long
#define dout if(debug and (debug_test == 0 or _t == debug_test) ) cerr<<" "
#define endl "\n";cout.flush()
#ifdef ONLINE_JUDGE
#define DEBUG 0.0
#else
#define DEBUG 1
#endif
int debug = DEBUG;// it will take care of itself on online-judge
int debug_test = 0; // test_case to be debugged ... 0 means all ... -1 means none
int _t = 0;// test_case counter

template<class T>void show(T first){dout<<first<<"\n";}
template<class T,class... Args>void show(T first,Args... args){dout<<first;show(args...);}
#define trace(...) _s(#__VA_ARGS__, __VA_ARGS__)
template<class T>void _s(const char* c,T& first){dout<<c<<" : "<<first<<"\n";}
template<class T,class... Args>void _s(const char *c,T first,Args... args)
{const char* t=strchr(c+1,',');dout;if(!debug)return;cerr.write(c,t-c)<<" : "<<first<< " |";_s(t+1,args...);}
template<class T>void _p(T x){if(!debug)return;int i=0;for(auto a: x){dout<<a<<",";if(i++ > 20)break;}}
template<class T,class U>ostream &operator<<(ostream &o,pair<T,U> &x){return o<<"("<<x.first<<","<<x.second<<")";}
template<class T>ostream &operator<<(ostream &os,vector<T> &x){dout<<"[";_p(x);dout<<"] ";return os;}
template<class T>ostream &operator<<(ostream &os,set<T> &x){dout<<"{";_p(x);dout<< "} ";return os;}
template<class T>ostream &operator<<(ostream &os,multiset<T> &x){dout<<"{";_p(x);dout<< "} ";return os;}
template<class T,class U>ostream &operator<<(ostream &os,map<T,U> &x){dout<<"[";_p(x);dout<< "] ";return os;}

typedef unsigned long long ulli;// rarely will be used
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef set<int> si;
template<class A,class B> using umap = unordered_map<A,B>;
template<class A,class B> using pqueue = priority_queue<A,vector<A>,B>;
typedef vector<vector<int>> matrix; // matrix matt(n,vector<int>(m,0));
#define dmatrix(n,m) matrix(n,vector<int>(m,0)) // to define matrix use dmatrix(n,m)
#define substring(i,j) substr(i,(j-i+1)) // both i,j are included
#define all(container) container.begin(),container.end()
#define FF first
#define SS second

template<class T>int sz(T &x){return (int)x.size();}
template<class T>bool sort_fun(T a,T b){return a>b;} // for desc sort // default sort is asc, use <() fxn
template<class T,class U>bool found(T t,U u){if(t.find(u)==t.end())return false;return true;}
struct Desc{bool operator()(int a,int b){return a>b;}}desc; // for descending sort
struct AscPQ{bool operator()(int a,int b){return a>b;}}; // for ascending PQ, does descending by default

const int mod = 1e9+7, inf = ((1LL<<((sizeof mod)*8-2))-1)<<1|1, none = inf/2-9;// inf is self adjustable
int add(int x,int y){int res=(x+y)%mod;return res<0?res+mod:res;}
int mul(int x,int y){int res=(x*1LL*y)%mod;return res<0?res+mod:res;}
int dx[] = {0,1,0,-1,1,1,-1,-1},dy[] = {1,0,-1,0,1,-1,-1,1};// use 0-3 for 4dir 0-7 for 8dir
// clang-format off

// code begins here

void solve()
{
    int n,m,q;
    cin>>n>>m>>q;
    set<pii> ha,va;
    multiset<int> hs,vs;
    ha.insert({0,n-1});
    va.insert({0,m-1});
    hs.insert(n);
    vs.insert(m);

    while(q--) {
        char t;int w; cin>>t>>w;
        if(t=='V') {
            pii who = *(--ha.lower_bound({w,1}));
            show("ha,who",ha,who);
            if(who.SS == w-1) {
            } else {
                pii ll = pii(who.FF,w-1);
                pii rr = pii(w,who.SS);
                ha.erase(who);
                ha.insert(ll);
                ha.insert(rr);
                show("before deleting ",who.SS-who.FF+1,hs);
                hs.erase(hs.find(who.SS-who.FF+1));
                hs.insert(ll.SS-ll.FF+1);
                hs.insert(rr.SS-rr.FF+1);
                show("after inserting",hs);
            }
        } else {
            pii who = *(--va.lower_bound({w,1}));
            show("va,who",va,who);
            if(who.SS == w-1) {
            } else {
                pii ll = pii(who.FF,w-1);
                pii rr = pii(w,who.SS);
                va.erase(who);
                va.insert(ll);
                va.insert(rr);
                vs.erase(vs.find(who.SS-who.FF+1));
                vs.insert(ll.SS-ll.FF+1);
                vs.insert(rr.SS-rr.FF+1);
            }
        }
        show("hs,vs",hs,vs);
        cout << *hs.rbegin() * *vs.rbegin() << endl;
    }

}

void preprocess()
{

}

signed main()
{
    #ifdef ONLINE_JUDGE
    ios_base::sync_with_stdio(0);cin.tie(0);
    #else
    //freopen("Input.txt","r",stdin);
    #endif
    std::cout << std::fixed; std::cout.precision(7);
    preprocess();
    int test=1;
    //cin>>test;
    for(int t = 1; t <= test; t++)_t = t,solve();
}
// a code by srbcheema1

// https://codeforces.com/contest/527/problem/C


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

// clang-format off
#define int long long
#define dout if(debug and (debug_test == 0 or _t == debug_test) ) cerr<<" "
#define endl "\n";cout.flush()
#ifdef ONLINE_JUDGE
#define DEBUG 0.0
#else
#define DEBUG 1
#endif
int debug = DEBUG;// it will take care of itself on online-judge
int debug_test = 0; // test_case to be debugged ... 0 means all ... -1 means none
int _t = 0;// test_case counter

template<class T>void show(T first){dout<<first<<"\n";}
template<class T,class... Args>void show(T first,Args... args){if(!debug)return;dout<<first;show(args...);}
#define trace(...) _s(#__VA_ARGS__, __VA_ARGS__)
template<class T>void _s(const char* c,T& first){dout<<c<<" : "<<first<<"\n";}
template<class T,class... Args>void _s(const char *c,T first,Args... args)
{if(!debug)return;const char* t=strchr(c+1,',');dout;cerr.write(c,t-c)<<" : "<<first<< " |";_s(t+1,args...);}
template<class T>void _p(T x){int i=0;for(auto a: x){dout<<a<<",";if(i++ > 20)break;}}
template<class T,class U>ostream &operator<<(ostream &o,pair<T,U> &x){return o<<"("<<x.first<<","<<x.second<<")";}
template<class T>ostream &operator<<(ostream &os,vector<T> &x){dout<<"[";_p(x);dout<<"] ";return os;}
template<class T>ostream &operator<<(ostream &os,set<T> &x){dout<<"{";_p(x);dout<< "} ";return os;}
template<class T>ostream &operator<<(ostream &os,multiset<T> &x){dout<<"{";_p(x);dout<< "} ";return os;}
template<class T,class U>ostream &operator<<(ostream &os,map<T,U> &x){dout<<"[";_p(x);dout<< "] ";return os;}

typedef unsigned long long ulli;// rarely will be used
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef set<int> si;
template<class A,class B> using umap = unordered_map<A,B>;
template<class A,class B> using pqueue = priority_queue<A,vector<A>,B>;
typedef vector<vector<int>> matrix; // matrix matt(n,vector<int>(m,0));
#define dmatrix(n,m) matrix(n,vector<int>(m,0)) // to define matrix use dmatrix(n,m)
#define substring(i,j) substr(i,(j-i+1)) // both i,j are included
#define all(container) container.begin(),container.end()
#define FF first
#define SS second

template<class T>int sz(T &x){return (int)x.size();}
template<class T>bool sort_fun(T a,T b){return a>b;} // for desc sort // default sort is asc, use <() fxn
template<class T,class U>bool found(T t,U u){if(t.find(u)==t.end())return false;return true;}
struct Desc{bool operator()(int a,int b){return a>b;}}desc; // for descending sort
struct AscPQ{bool operator()(int a,int b){return a>b;}}; // for ascending PQ, does descending by default

const int mod = 1e9+7, inf = ((1LL<<((sizeof mod)*8-2))-1)<<1|1, none = inf/2-9;// inf is self adjustable
int add(int x,int y){int res=(x+y)%mod;return res<0?res+mod:res;}
int mul(int x,int y){int res=(x*1LL*y)%mod;return res<0?res+mod:res;}
int dx[] = {0,1,0,-1,1,1,-1,-1},dy[] = {1,0,-1,0,1,-1,-1,1};// use 0-3 for 4dir 0-7 for 8dir
// clang-format off

// code begins here

void solve()
{
    int n,m,q;
    cin>>n>>m>>q;
    set<pii> ha,va;
    multiset<int> hs,vs;
    ha.insert({0,n-1});
    va.insert({0,m-1});
    hs.insert(n);
    vs.insert(m);

    while(q--) {
        char t;int w; cin>>t>>w;
        if(t=='V') {
            pii who = *(--ha.lower_bound({w,1}));
            show("ha,who",ha,who);
            if(who.SS == w-1) {
            } else {
                pii ll = pii(who.FF,w-1);
                pii rr = pii(w,who.SS);
                ha.erase(who);
                ha.insert(ll);
                ha.insert(rr);
                show("before deleting ",who.SS-who.FF+1,hs);
                hs.erase(hs.find(who.SS-who.FF+1));
                hs.insert(ll.SS-ll.FF+1);
                hs.insert(rr.SS-rr.FF+1);
                show("after inserting",hs);
            }
        } else {
            pii who = *(--va.lower_bound({w,1}));
            show("va,who",va,who);
            if(who.SS == w-1) {
            } else {
                pii ll = pii(who.FF,w-1);
                pii rr = pii(w,who.SS);
                va.erase(who);
                va.insert(ll);
                va.insert(rr);
                vs.erase(vs.find(who.SS-who.FF+1));
                vs.insert(ll.SS-ll.FF+1);
                vs.insert(rr.SS-rr.FF+1);
            }
        }
        show("hs,vs",hs,vs);
        cout << *hs.rbegin() * *vs.rbegin() << endl;
    }

}

void preprocess()
{

}

signed main()
{
    #ifdef ONLINE_JUDGE
    ios_base::sync_with_stdio(0);cin.tie(0);
    #else
    //freopen("Input.txt","r",stdin);
    #endif
    std::cout << std::fixed; std::cout.precision(7);
    preprocess();
    int test=1;
    //cin>>test;
    for(int t = 1; t <= test; t++)_t = t,solve();
}
// a code by srbcheema1

// https://codeforces.com/contest/527/problem/C


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

// clang-format off
#define int long long
#define dout if(debug and (debug_test == 0 or _t == debug_test) ) cerr<<" "
#define endl "\n";cout.flush()
#ifdef ONLINE_JUDGE
#define DEBUG 0.0
#else
#define DEBUG 1
#endif
int debug = DEBUG;// it will take care of itself on online-judge
int debug_test = 0; // test_case to be debugged ... 0 means all ... -1 means none
int _t = 0;// test_case counter

typedef unsigned long long ulli;// rarely will be used
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef set<int> si;
template<class A,class B> using umap = unordered_map<A,B>;
template<class A,class B> using pqueue = priority_queue<A,vector<A>,B>;
typedef vector<vector<int>> matrix; // matrix matt(n,vector<int>(m,0));
#define dmatrix(n,m) matrix(n,vector<int>(m,0)) // to define matrix use dmatrix(n,m)
#define substring(i,j) substr(i,(j-i+1)) // both i,j are included
#define all(container) container.begin(),container.end()
#define FF first
#define SS second
#define TP template
#define IND if(!debug)return

TP<class T>void show(T &first){IND;dout<<first<<"\n";}
TP<class T,class... Args>void show(T &first,Args&... args){IND;dout<<first;show(args...);}
TP<class T>void show(T &&first){IND;dout<<first<<"\n";}
TP<class T,class... Args>void show(T &&first,Args&&... args){IND;dout<<first;show(args...);}

TP<class T>void _p(T &x){IND;int i=0;for(auto a: x){dout<<a<<",";if(i++ > 20)break;}}
TP<class T>ostream &operator<<(ostream &os,vector<T> &x){dout<<"[";_p(x);dout<<"] ";return os;}
TP<class T>ostream &operator<<(ostream &os,set<T> &x){dout<<"{";_p(x);dout<< "} ";return os;}
TP<class T>ostream &operator<<(ostream &os,multiset<T> &x){dout<<"{";_p(x);dout<< "} ";return os;}
TP<class T,class U>ostream &operator<<(ostream &o,pair<T,U> &x){dout<<"("<<x.FF<<","<<x.SS<<")";return o;}
TP<class T,class U>ostream &operator<<(ostream &os,map<T,U> &x){dout<<"[";_p(x);dout<< "] ";return os;}

TP<class T>int sz(T &x){return (int)x.size();}
TP<class T>bool sort_fun(T a,T b){return a>b;} // for desc sort // default sort is asc, use <() fxn
TP<class T,class U>bool found(T t,U u){if(t.find(u)==t.end())return false;return true;}
struct Desc{bool operator()(int a,int b){return a>b;}}desc; // for descending sort
struct AscPQ{bool operator()(int a,int b){return a>b;}}; // for ascending PQ, does descending by default

const int mod = 1e9+7, inf = ((1LL<<((sizeof mod)*8-2))-1)<<1|1, none = inf/2-9;// inf is self adjustable
int add(int x,int y){int res=(x+y)%mod;return res<0?res+mod:res;}
int mul(int x,int y){int res=(x*1LL*y)%mod;return res<0?res+mod:res;}
int dx[] = {0,1,0,-1,1,1,-1,-1},dy[] = {1,0,-1,0,1,-1,-1,1};// use 0-3 for 4dir 0-7 for 8dir
// clang-format off

// code begins here

void solve()
{
    int n,m,q;
    cin>>n>>m>>q;
    set<pii> ha,va;
    multiset<int> hs,vs;
    ha.insert({0,n-1});
    va.insert({0,m-1});
    hs.insert(n);
    vs.insert(m);

    while(q--) {
        char t;int w; cin>>t>>w;
        if(t=='V') {
            pii who = *(--ha.lower_bound({w,1}));
            show("ha,who",ha,who);
            if(who.SS == w-1) {
            } else {
                pii ll = pii(who.FF,w-1);
                pii rr = pii(w,who.SS);
                ha.erase(who);
                ha.insert(ll);
                ha.insert(rr);
                show("before deleting ",who.SS-who.FF+1,hs);
                hs.erase(hs.find(who.SS-who.FF+1));
                hs.insert(ll.SS-ll.FF+1);
                hs.insert(rr.SS-rr.FF+1);
                show("after inserting",hs);
            }
        } else {
            pii who = *(--va.lower_bound({w,1}));
            show("va,who",va,who);
            if(who.SS == w-1) {
            } else {
                pii ll = pii(who.FF,w-1);
                pii rr = pii(w,who.SS);
                va.erase(who);
                va.insert(ll);
                va.insert(rr);
                vs.erase(vs.find(who.SS-who.FF+1));
                vs.insert(ll.SS-ll.FF+1);
                vs.insert(rr.SS-rr.FF+1);
            }
        }
        show("hs,vs",hs,vs);
        cout << *hs.rbegin() * *vs.rbegin() << endl;
    }

}

void preprocess()
{

}

signed main()
{
    #ifdef ONLINE_JUDGE
    ios_base::sync_with_stdio(0);cin.tie(0);
    #else
    //freopen("Input.txt","r",stdin);
    #endif
    std::cout << std::fixed; std::cout.precision(7);
    preprocess();
    int test=1;
    //cin>>test;
    for(int t = 1; t <= test; t++)_t = t,solve();
}
// a code by srbcheema1

// https://codeforces.com/contest/527/problem/C


                                                    /* Pain. Anger. Hatred. Ego.
                                                      Survive. Live. Win. Conquer. */

                                                          /*#Quota_Reform .
                                                        #We_Want_Safe_Roads .
                                                          #We_Want_Justice .
                                                            #Support_Us .
                                                            #Bangladesh .
                                                          */

#include<bits/stdc++.h>
using namespace std;
typedef long long LL ;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

#define ook order_of_key
#define fbk find_by_order
#define bug printf("Massacre.\n");
#define pf printf
#define sf scanf
#define pb push_back
#define r0 return 0
#define ff first
#define ss second
#define mp make_pair
#define set0(a) memset ((a), 0 , sizeof(a))
#define set1(a) memset((a),-1,sizeof (a))
#define si(a) scanf("%d" , &a)
#define sl(a) scanf("%lld" , &a)
#define sii(a,b) scanf("%d %d" , &a , &b)
#define siii(a,b,c) scanf("%d %d %d" , &a , &b, &c)
#define sll(a,b) scanf("%lld %lld" , &a , &b)
#define slll(a,b,c) scanf("%lld %lld %lld" , &a , &b, &c)
#define pll pair <LL, LL>
#define pii pair <int, int>
#define vi  vector <int>
#define vl  vector <LL>
#define vii vector <pair <int, int> >
#define vll vector < pair <LL, LL> >
#define mod 1000000007

//using namespace __gnu_pbds;
//typedef tree < int, null_type ,less<int>,rb_tree_tag,tree_order_statistics_node_update > ordered_set;

void func(void)
{
        freopen("input.c","r",stdin);
        freopen("output.c","w",stdout);
}

void print(vector <LL> &v){
    cout << v.size() << endl;
    for(int i = 0; i < v.size(); i++){
        pf("%lld ", v[i]);
    }
    pf("\n");
}

void print(vector <pll> &v){
    cout << v.size() << endl;
    for(int i = 0; i < v.size(); i++){
        pf("%lld %lld\n", v[i].ff, v[i].ss);
    }
}

void print(double d){
    cout << fixed << setprecision(10) << d << endl;
}

void print(string s, double d){
    cout << s << " ";
    cout << fixed << setprecision(10) << d << endl;
}

multiset <LL> r, c;
multiset <pll> rRange, cRange;

void del(LL val, multiset <LL> &r, multiset <pll> &rRange){
    pll p = {val, -1000};
    auto it = rRange.lower_bound(p);
    it--;
    p = *it;
    rRange.erase(it);
    r.erase(r.lower_bound(p.ss - p.ff));
    rRange.insert({p.ff, val});
    rRange.insert({val, p.ss});
    r.insert(val - p.ff);
    r.insert(p.ss - val);
}

int main(){
//    ios_base::sync_with_stdio(0); cin.tie(0);
    LL n, q, i,j = 0, temp, t, k, ans = 0, sum = 0, x, y, z, cnt = 0, m, fg = 0, mx = 0, mx1 = 0, mn = 8000000000000000000, mn1 = 8000000000000000000;
    slll(m, n, k);
    rRange.insert({0, n});
    cRange.insert({0, m});
    r.insert(n);
    c.insert(m);
    while(k--){
        //string s;
        char s[50];
        sf("%s", s);
        sl(x);
        if(s[0] == 'H'){
            del(x, r, rRange);
        }
        else{
            del(x, c, cRange);
        }
        auto it = r.end();
        it--;
        auto it2 = c.end();
        it2--;
        pf("%lld\n", *it * *it2);
    }
}


                                                    /* Pain. Anger. Hatred. Ego.
                                                      Survive. Live. Win. Conquer. */

                                                          /*#Quota_Reform .
                                                        #We_Want_Safe_Roads .
                                                          #We_Want_Justice .
                                                            #Support_Us .
                                                            #Bangladesh .
                                                          */

#include<bits/stdc++.h>
using namespace std;
typedef long long LL ;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

#define ook order_of_key
#define fbk find_by_order
#define bug printf("Massacre.\n");
#define pf printf
#define sf scanf
#define pb push_back
#define r0 return 0
#define ff first
#define ss second
#define mp make_pair
#define set0(a) memset ((a), 0 , sizeof(a))
#define set1(a) memset((a),-1,sizeof (a))
#define si(a) scanf("%d" , &a)
#define sl(a) scanf("%lld" , &a)
#define sii(a,b) scanf("%d %d" , &a , &b)
#define siii(a,b,c) scanf("%d %d %d" , &a , &b, &c)
#define sll(a,b) scanf("%lld %lld" , &a , &b)
#define slll(a,b,c) scanf("%lld %lld %lld" , &a , &b, &c)
#define pll pair <LL, LL>
#define pii pair <int, int>
#define vi  vector <int>
#define vl  vector <LL>
#define vii vector <pair <int, int> >
#define vll vector < pair <LL, LL> >
#define mod 1000000007

//using namespace __gnu_pbds;
//typedef tree < int, null_type ,less<int>,rb_tree_tag,tree_order_statistics_node_update > ordered_set;

void func(void)
{
        freopen("input.c","r",stdin);
        freopen("output.c","w",stdout);
}

void print(vector <LL> &v){
    cout << v.size() << endl;
    for(int i = 0; i < v.size(); i++){
        pf("%lld ", v[i]);
    }
    pf("\n");
}

void print(vector <pll> &v){
    cout << v.size() << endl;
    for(int i = 0; i < v.size(); i++){
        pf("%lld %lld\n", v[i].ff, v[i].ss);
    }
}

void print(double d){
    cout << fixed << setprecision(10) << d << endl;
}

void print(string s, double d){
    cout << s << " ";
    cout << fixed << setprecision(10) << d << endl;
}

multiset <LL> r, c;
multiset <pll> rRange, cRange;

void del(LL val, multiset <LL> &r, multiset <pll> &rRange){
    pll p = {val, -1000};
    auto it = rRange.lower_bound(p);
    it--;
    p = *it;
    rRange.erase(it);
    r.erase(r.find(p.ss - p.ff));
    rRange.insert({p.ff, val});
    rRange.insert({val, p.ss});
    r.insert(val - p.ff);
    r.insert(p.ss - val);
}

int main(){
//    ios_base::sync_with_stdio(0); cin.tie(0);
    LL n, q, i,j = 0, temp, t, k, ans = 0, sum = 0, x, y, z, cnt = 0, m, fg = 0, mx = 0, mx1 = 0, mn = 8000000000000000000, mn1 = 8000000000000000000;
    slll(m, n, k);
    rRange.insert({0, n});
    cRange.insert({0, m});
    r.insert(n);
    c.insert(m);
    while(k--){
        string s;
        cin >> s >> x;
        if(s[0] == 'H'){
            del(x, r, rRange);
        }
        else{
            del(x, c, cRange);
        }
        auto it = r.end();
        it--;
        auto it2 = c.end();
        it2--;
        pf("%lld\n", *it * *it2);
    }
}


                                                    /* Pain. Anger. Hatred. Ego.
                                                      Survive. Live. Win. Conquer. */

                                                          /*#Quota_Reform .
                                                        #We_Want_Safe_Roads .
                                                          #We_Want_Justice .
                                                            #Support_Us .
                                                            #Bangladesh .
                                                          */

#include<bits/stdc++.h>
using namespace std;
typedef long long LL ;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

#define ook order_of_key
#define fbk find_by_order
#define bug printf("Massacre.\n");
#define pf printf
#define sf scanf
#define pb push_back
#define r0 return 0
#define ff first
#define ss second
#define mp make_pair
#define set0(a) memset ((a), 0 , sizeof(a))
#define set1(a) memset((a),-1,sizeof (a))
#define si(a) scanf("%d" , &a)
#define sl(a) scanf("%lld" , &a)
#define sii(a,b) scanf("%d %d" , &a , &b)
#define siii(a,b,c) scanf("%d %d %d" , &a , &b, &c)
#define sll(a,b) scanf("%lld %lld" , &a , &b)
#define slll(a,b,c) scanf("%lld %lld %lld" , &a , &b, &c)
#define pll pair <LL, LL>
#define pii pair <int, int>
#define vi  vector <int>
#define vl  vector <LL>
#define vii vector <pair <int, int> >
#define vll vector < pair <LL, LL> >
#define mod 1000000007

//using namespace __gnu_pbds;
//typedef tree < int, null_type ,less<int>,rb_tree_tag,tree_order_statistics_node_update > ordered_set;

void func(void)
{
        freopen("input.c","r",stdin);
        freopen("output.c","w",stdout);
}

void print(vector <LL> &v){
    cout << v.size() << endl;
    for(int i = 0; i < v.size(); i++){
        pf("%lld ", v[i]);
    }
    pf("\n");
}

void print(vector <pll> &v){
    cout << v.size() << endl;
    for(int i = 0; i < v.size(); i++){
        pf("%lld %lld\n", v[i].ff, v[i].ss);
    }
}

void print(double d){
    cout << fixed << setprecision(10) << d << endl;
}

void print(string s, double d){
    cout << s << " ";
    cout << fixed << setprecision(10) << d << endl;
}

multiset <LL> r, c;
multiset <pll> rRange, cRange;

void del(LL val, multiset <LL> &r, multiset <pll> &rRange){
    pll p = {val, -1000};
    auto it = rRange.lower_bound(p);
    it--;
    p = *it;
    rRange.erase(it);
    r.erase(r.lower_bound(p.ss - p.ff));
    rRange.insert({p.ff, val});
    rRange.insert({val, p.ss});
    r.insert(val - p.ff);
    r.insert(p.ss - val);
}

int main(){
//    ios_base::sync_with_stdio(0); cin.tie(0);
    LL n, q, i,j = 0, temp, t, k, ans = 0, sum = 0, x, y, z, cnt = 0, m, fg = 0, mx = 0, mx1 = 0, mn = 8000000000000000000, mn1 = 8000000000000000000;
    slll(m, n, k);
    rRange.insert({0, n});
    cRange.insert({0, m});
    r.insert(n);
    c.insert(m);
    while(k--){
        string s;
        cin >> s >> x;
        if(s[0] == 'H'){
            del(x, r, rRange);
        }
        else{
            del(x, c, cRange);
        }
        auto it = r.end();
        it--;
        auto it2 = c.end();
        it2--;
        pf("%lld\n", *it * *it2);
    }
}


#include<bits/stdc++.h>
using namespace std;
set<int> wp;
set<int> hp;
int we[20005];
int he[20005];
int main() {
    int w, h, n;
    scanf("%d %d %d", &w, &h, &n);
    wp.insert(0);
    wp.insert(w);
    hp.insert(0);
    hp.insert(h);
    memset(we, 0, sizeof(we));
    memset(he, 0, sizeof(he));
    we[w] += 1;
    he[h] += 1;
    we[0] += 1;
    he[0] += 1;

    int i;
    for(i = 0; i < n; i++) {
        char s[2];
        int num;
        scanf("%s", s);
        scanf("%d", &num);
        if(s[0]=='H') {
            hp.insert(num);
            set<int>::iterator l = hp.find(num);
            set<int>::iterator r = hp.find(num);
            l--;
            r++;
            he[(*r)-(*l)] -= 1;
            he[(*r)-num] += 1;
            he[num-(*l)] += 1;
        } else {
            wp.insert(num);
            set<int>::iterator l = wp.find(num);
            set<int>::iterator r = wp.find(num);
            l--;
            r++;
            we[(*r)-(*l)] -= 1;
            we[(*r)-num] += 1;
            we[num-(*l)] += 1;
        }
        int x = w;
        int mxw, mxh;
        while(we[x]==0){
            x--;
        }
        mxw = x;

        x = h;
        while(he[x]==0){
            x--;
        }
        mxh = x;
        long long si = (long long)mxw * (long long)mxh;
        printf("%lld\n", si);

    }
    return 0;
}


#include<bits/stdc++.h>
#define pi 3.1415
#define ll long long
#define pii pair<ll,ll>
#define debug(a) cout<<a<<'\n'
#define maxn 100009
#define MOD 1000000007
#define INF (int)300009
#define inp freopen("input.txt", "r", stdin)
#define out freopen("out.txt", "w", stdout)
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    ll vet[maxn];
    ll mark[maxn];
    set<pii> lp;
    for(int i=0;i<n;i++){
        cin>>vet[i];
        mark[i]=1;
        lp.insert({vet[i],i});
    }
    while(lp.size()>1){
        auto x1=*lp.begin();
        auto x2=*next(lp.begin(),1);
        if(x1.first==x2.first){
            mark[x1.second]=-1;
            lp.erase({x1.first,x1.second});
            lp.erase({x2.first,x2.second});
            vet[x2.second]=x2.first<<1  ;
            lp.insert({x2.first*2,x2.second});
        }
        else lp.erase({x1.first,x1.second});
    }
    int cont=0;
    for(int i=0;i<n;i++){
        if(mark[i]==1) cont++;
    }
    cout<<cont<<endl;
    for(int i=0;i<n;i++){
        if(mark[i]==1) cout<<vet[i]<<" ";
    }
    cout<<endl;
    return 0;
}


#include<bits/stdc++.h>
#define pi 3.1415
#define ll long long
#define pii pair<ll,ll>
#define debug(a) cout<<a<<'\n'
#define maxn 100009
#define MOD 1000000007
#define INF (int)300009
#define inp freopen("input.txt", "r", stdin)
#define out freopen("out.txt", "w", stdout)
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    ll vet[maxn];
    ll mark[maxn];
    priority_queue<pii,vector<pii>,greater<pii> >pq;
    for(int i=0;i<n;i++){
        cin>>vet[i];
        mark[i]=1;
        pq.push({vet[i],i});
    }
    while(pq.size()>1){
        pii x1=pq.top();
        pq.pop();
        pii x2=pq.top();
        if(x1.first==x2.first){
            mark[x1.second]=-1;
            pq.pop();
            vet[x2.second]=x2.first<<1;
            pq.push({x2.first*2,x2.second});
        }
    }
    int cont=0;
    for(int i=0;i<n;i++){
        if(mark[i]==1) cont++;
    }
    cout<<cont<<endl;
    for(int i=0;i<n;i++){
        if(mark[i]==1) cout<<vet[i]<<" ";
    }
    cout<<endl;
    return 0;
}


#include <iostream>
#include <cmath>
#include <map>
using namespace std;
int main(){
    long long n,count=0;
    cin>>n;
    long long arr[n];
    map<long,long> m;
    for(int i=1;i<=n;i++){
        cin>>arr[i];
        while(m[arr[i]]){
            arr[m[arr[i]]]=0;
            m[arr[i]]=0;
            arr[i]*=2;
            count++;
        }
        m[arr[i]]=i;
    }
    cout<<n-count<<endl;
    for(int i=1;i<=n;i++)
        if(arr[i]!=0)
            cout<<arr[i]<<' ';
}


#include <iostream>
#include <cmath>
#include <map>
using namespace std;
int main(){
    long long n,count=0;
    cin>>n;
    long long arr[n];
    map<long,long> m;
    for(int i=1;i<=n;i++){
        cin>>arr[i];
        while(m[arr[i]]){
            arr[m[arr[i]]]=0;
            m[arr[i]]=0;
            arr[i]*=2;
            count++;
        }
        m[arr[i]]=i;
    }
    cout<<n-count<<endl;
    for(int i=1;i<=n;i++)
        if(arr[i])
            cout<<arr[i]<<' ';
}


#include <bits/stdc++.h>
using namespace std;
int main(){
    long long n,count=0;
    cin>>n;
    long long arr[n];
    map<long,long> m;
    for(int i=1;i<=n;i++){
        cin>>arr[i];
        while(m[arr[i]]){
            arr[m[arr[i]]]=0;
            m[arr[i]]=0;
            arr[i]*=2;
            count++;
        }
        m[arr[i]]=i;
    }
    cout<<n-count<<endl;
    for(int i=1;i<=n;i++)
        if(arr[i])
            cout<<arr[i]<<' ';
}


#include <iostream>
#include <cmath>
#include <map>
using namespace std;
int main(){
    long long n,count=0;
    cin>>n;
    long long arr[n];
    map<long,long> m;
    for(int i=1;i<=n;i++){
        scanf("%lld",&arr[i]);
        while(m[arr[i]]){
            arr[m[arr[i]]]=0;
            m[arr[i]]=0;
            arr[i]*=2;
            count++;
        }
        m[arr[i]]=i;
    }
    cout<<n-count<<endl;
    for(int i=1;i<=n;i++)
        if(arr[i]!=0)
            cout<<arr[i]<<' ';
}


#include <iostream>
#include <cmath>
#include <map>
using namespace std;
int main(){
    long long n,count=0;
    cin>>n;
    long long arr[n];
    map<long,long> m;
    for(int i=1;i<=n;i++){
        cin>>arr[i];
        while(m[arr[i]]){
            arr[m[arr[i]]]=0;
            m[arr[i]]=0;
            arr[i]*=2;
            count++;
        }
        m[arr[i]]=i;
    }
    cout<<n-count<<endl;
    for(int i=1;i<=n-count;i++)
        if(arr[i]!=0)
            cout<<arr[i]<<' ';
}


#include <iostream>
#include <cmath>
#include <map>
using namespace std;
int main(){
    long long n,count=0;
    cin>>n;
    long long arr[n];
    map<long long ,long long> m;
    for(int i=1;i<=n;i++){
        scanf("%lld",&arr[i]);
        while(m[arr[i]]){
            arr[m[arr[i]]]=0;
            m[arr[i]]=0;
            arr[i]*=2;
            count++;
        }
        m[arr[i]]=i;
    }
    cout<<n-count<<endl;
    for(int i=1;i<=n;i++)
        if(arr[i])
            cout<<arr[i]<<' ';
}


#include <iostream>
#include <cmath>
#include <map>
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long n,count=0;
    cin>>n;
    long long arr[n];
    map<long,long> m;
    for(int i=1;i<=n;i++){
        cin>>arr[i];
        while(m[arr[i]]){
            arr[m[arr[i]]]=0;
            m[arr[i]]=0;
            arr[i]*=2;
            count++;
        }
        m[arr[i]]=i;
    }
    cout<<n-count<<endl;
    for(int i=1;i<=n;i++)
        if(arr[i]!=0)
            cout<<arr[i]<<' ';
}


#include <iostream>
#include <cmath>
#include <map>
using namespace std;
int main(){
    long long n,count=0;
    cin>>n;
    long long arr[n];
    map<long long ,long long> m;
    for(int i=1;i<=n;i++){
        cin>>arr[i];
        while(m[arr[i]]){
            arr[m[arr[i]]]=0;
            m[arr[i]]=0;
            arr[i]*=2;
            count++;
        }
        m[arr[i]]=i;
    }
    cout<<n-count<<endl;
    for(int i=1;i<=n;i++)
        if(arr[i])
            cout<<arr[i]<<' ';
}


#include<bits/stdc++.h>
using namespace std;
map<long long, set<long long> > m;
int main()
{
    // set<long long> s;
    // s.remove(5);
    int n;
    cin>>n;
    long long ar[n];
    for(int i=0;i<n;i++)
    {
        cin>>ar[i];
        m[ar[i]].insert(i);
    }
    int s=0;
    queue<int> q;
    for(int i=0;i<n;i++)
    {
        if(m[ar[i]].size() >= 2)
        {
            q.push(i);
        }
    }
    // //cout<<"here";
    while(!q.empty())
    {
        //cout<<"X: "<<i<<endl;
        int i = q.front();
        q.pop();
        if(ar[i]!=-1 && m[ar[i]].size() >=2)
        {
            long long pos = *(m[ar[i]].begin());
            //cout<<"Pos: "<<pos<<endl;
            m[ar[i]].erase(m[ar[i]].begin());
            //cout<<ar[i]<<endl;
            long long t=pos;
            pos = *(m[ar[t]].begin());
            ar[t]=-1;
            //cout<<"Next: "<<pos<<endl;
            ar[pos]*=2;
            m[ar[pos]].insert(pos);
            if(m[ar[pos]].size()>=2)
            {
                q.push(pos);
            }
            m[ar[pos]/2].erase(m[ar[pos]/2].begin());
        }
    }
    int c=0;
    for(int i=0;i<n;i++)
    {
        if(ar[i]!=-1)
        {
            c++;
            // cout<<ar[i]<<" ";
        }
    }
    cout<<c<<endl;
    for(int i=0;i<n;i++)
    {
        if(ar[i]!=-1)
        {
            cout<<ar[i]<<" ";
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
map<long long, set<long long> > m;
int main()
{
    // set<long long> s;
    // s.remove(5);
    int n;
    cin>>n;
    long long ar[n];
    for(int i=0;i<n;i++)
    {
        cin>>ar[i];
        m[ar[i]].insert(i);
    }
    int s=0;
    queue<long long> q;
    for(long long i=0;i<n;i++)
    {
        if(m[ar[i]].size() >= 2)
        {
            q.push(i);
        }
    }
    // //cout<<"here";
    while(!q.empty())
    {
        //cout<<"X: "<<i<<endl;
        int i = q.front();
        q.pop();
        if(m[ar[i]].size() >=2)
        {
            set<long long>::iterator it = m[ar[i]].begin();
            long long pos = *(it);
            it++;
            long long pos2 = *(it);
            m[ar[i]].erase(m[ar[i]].begin());
            m[ar[i]].erase(it);

            ar[pos2]*=2;
            m[ar[pos2]].insert(pos2);

            if(m[ar[pos2]].size() >= 2)
            {
                q.push(*(m[ar[pos2]].begin()));
            }
            if(m[ar[pos]].size() >=2 )
            {
                q.push(*(m[ar[pos]].begin()));
            }
            ar[pos] = -1;
            //cout<<"Pos: "<<pos<<endl;
            // m[ar[i]].erase(m[ar[i]].begin());
            //cout<<ar[i]<<endl;
            // long long t=pos;
            // pos = *(m[ar[t]].begin());
            // if(m[ar[i]].size()>=2)
            // {
            //     q.push(i);
            // }

            // ar[t]=-1;
            //cout<<"Next: "<<pos<<endl;
            // ar[pos]*=2;
            // m[ar[pos]].insert(pos);
            // if(m[ar[i]].size()>=2)
            // {
            //     q.push(i);
            // }
            // m[ar[pos]/2].erase(m[ar[pos]/2].begin());
            // if(m[ar[pos]/2].size()>=2)
            // {
            //     q.push(pos);
            // }
        }
    }
    int c=0;
    for(int i=0;i<n;i++)
    {
        if(ar[i]!=-1)
        {
            c++;
            // cout<<ar[i]<<" ";
        }
    }
    cout<<c<<endl;
    for(int i=0;i<n;i++)
    {
        if(ar[i]!=-1)
        {
            cout<<ar[i]<<" ";
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
map<long long, set<long long> > m;
int main()
{
    // set<long long> s;
    // s.remove(5);
    int n;
    cin>>n;
    long long ar[n];
    for(int i=0;i<n;i++)
    {
        cin>>ar[i];
        m[ar[i]].insert(i);
    }
    int s=0;
    set<long long> q;
    for(long long i=0;i<n;i++)
    {
        if(m[ar[i]].size() >= 2)
        {
            q.insert(ar[i]);
        }
    }
    // //cout<<"here";
    while(!q.empty())
    {
        //cout<<"X: "<<i<<endl;
        long long  i = *q.begin();
        q.erase(q.begin());
        if(m[i].size() >=2)
        {
            set<long long>::iterator it = m[i].begin();
            long long pos = *(it);
            it++;
            long long pos2 = *(it);
            m[i].erase(m[i].begin());
            m[i].erase(it);

            ar[pos2]*=2;
            m[ar[pos2]].insert(pos2);

            if(m[ar[pos2]].size() >= 2)
            {
                q.insert(ar[pos2]);
            }
            if(m[ar[pos]].size() >=2 )
            {
                q.insert(ar[pos]);
            }
            ar[pos] = -1;
            //cout<<"Pos: "<<pos<<endl;
            // m[ar[i]].erase(m[ar[i]].begin());
            //cout<<ar[i]<<endl;
            // long long t=pos;
            // pos = *(m[ar[t]].begin());
            // if(m[ar[i]].size()>=2)
            // {
            //     q.push(i);
            // }

            // ar[t]=-1;
            //cout<<"Next: "<<pos<<endl;
            // ar[pos]*=2;
            // m[ar[pos]].insert(pos);
            // if(m[ar[i]].size()>=2)
            // {
            //     q.push(i);
            // }
            // m[ar[pos]/2].erase(m[ar[pos]/2].begin());
            // if(m[ar[pos]/2].size()>=2)
            // {
            //     q.push(pos);
            // }
        }
    }
    int c=0;
    for(int i=0;i<n;i++)
    {
        if(ar[i]!=-1)
        {
            c++;
            // cout<<ar[i]<<" ";
        }
    }
    cout<<c<<endl;
    for(int i=0;i<n;i++)
    {
        if(ar[i]!=-1)
        {
            cout<<ar[i]<<" ";
        }
    }
}
//  16 4 12 8


#include<bits/stdc++.h>
using namespace std;
map<long long, set<long long> > m;
int main()
{
    // set<long long> s;
    // s.remove(5);
    int n;
    cin>>n;
    long long ar[n];
    for(int i=0;i<n;i++)
    {
        cin>>ar[i];
        m[ar[i]].insert(i);
    }
    for(int i=0;i<n;i++)
    {
        set<long long>::iterator it = m[ar[i]].begin();
        while(it!=m[ar[i]].end())
        {
            //cout<<*it;
            it++;
        }
        //cout<<endl;
    }
    // //cout<<"here";
    for(int i=0;i<n;i++)
    {
        //cout<<"X: "<<i<<endl;
        if(ar[i]!=-1 && m[ar[i]].size() >=2)
        {
            long long pos = *(m[ar[i]].begin());
            //cout<<"Pos: "<<pos<<endl;
            m[ar[i]].erase(m[ar[i]].begin());
            //cout<<ar[i]<<endl;
            long long t=pos;
            pos = *(m[ar[t]].begin());
            ar[t]=-1;
            //cout<<"Next: "<<pos<<endl;
            ar[pos]*=2;
            m[ar[pos]].insert(pos);
            m[ar[pos]/2].erase(m[ar[pos]/2].begin());
        }
    }
    int c=0;
    for(int i=0;i<n;i++)
    {
        if(ar[i]!=-1)
        {
            c++;
            // cout<<ar[i]<<" ";
        }
    }
    cout<<c<<endl;
    for(int i=0;i<n;i++)
    {
        if(ar[i]!=-1)
        {
            cout<<ar[i]<<" ";
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
map<long long, set<long long> > m;
int main()
{
    // set<long long> s;
    // s.remove(5);
    int n;
    cin>>n;
    long long ar[n];
    for(int i=0;i<n;i++)
    {
        cin>>ar[i];
        m[ar[i]].insert(i);
    }
    int s=0;
    queue<long long> q;
    for(long long i=0;i<n;i++)
    {
        if(m[ar[i]].size() >= 2)
        {
            q.push(i);
        }
    }
    // //cout<<"here";
    while(!q.empty())
    {
        //cout<<"X: "<<i<<endl;
        int i = q.front();
        q.pop();
        if(ar[i]!=-1 && m[ar[i]].size() >=2)
        {
            set<long long>::iterator it = m[ar[i]].begin();
            long long pos = *(it);
            it++;
            long long pos2 = *(it);
            m[ar[i]].erase(m[ar[i]].begin());
            m[ar[i]].erase(it);

            ar[pos] = -1;
            ar[pos2]*=2;
            m[ar[pos2]].insert(pos2);

            if(m[ar[pos2]].size() >= 2)
            {
                q.push(*(m[ar[pos2]].begin()));
            }
            if(m[ar[pos]].size() >=2 )
            {
                q.push(*(m[ar[pos2]].begin()));
            }
            //cout<<"Pos: "<<pos<<endl;
            // m[ar[i]].erase(m[ar[i]].begin());
            //cout<<ar[i]<<endl;
            // long long t=pos;
            // pos = *(m[ar[t]].begin());
            // if(m[ar[i]].size()>=2)
            // {
            //     q.push(i);
            // }

            // ar[t]=-1;
            //cout<<"Next: "<<pos<<endl;
            // ar[pos]*=2;
            // m[ar[pos]].insert(pos);
            // if(m[ar[i]].size()>=2)
            // {
            //     q.push(i);
            // }
            // m[ar[pos]/2].erase(m[ar[pos]/2].begin());
            // if(m[ar[pos]/2].size()>=2)
            // {
            //     q.push(pos);
            // }
        }
    }
    int c=0;
    for(int i=0;i<n;i++)
    {
        if(ar[i]!=-1)
        {
            c++;
            // cout<<ar[i]<<" ";
        }
    }
    cout<<c<<endl;
    for(int i=0;i<n;i++)
    {
        if(ar[i]!=-1)
        {
            cout<<ar[i]<<" ";
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
map<long long, set<long long> > m;
int main()
{
    // set<long long> s;
    // s.remove(5);
    int n;
    cin>>n;
    long long ar[n];
    for(int i=0;i<n;i++)
    {
        cin>>ar[i];
        m[ar[i]].insert(i);
    }
    int s=0;
    queue<long long> q;
    for(long long i=0;i<n;i++)
    {
        if(m[ar[i]].size() >= 2)
        {
            q.push(i);
        }
    }
    // //cout<<"here";
    while(!q.empty())
    {
        //cout<<"X: "<<i<<endl;
        int i = q.front();
        q.pop();
        if(ar[i]!=-1 && m[ar[i]].size() >=2)
        {
            long long pos = *(m[ar[i]].begin());
            //cout<<"Pos: "<<pos<<endl;
            m[ar[i]].erase(m[ar[i]].begin());
            //cout<<ar[i]<<endl;
            long long t=pos;
            pos = *(m[ar[t]].begin());
            if(m[ar[i]].size()>=2)
            {
                q.push(i);
            }

            ar[t]=-1;
            //cout<<"Next: "<<pos<<endl;
            ar[pos]*=2;
            m[ar[pos]].insert(pos);
            if(m[ar[i]].size()>=2)
            {
                q.push(i);
            }
            m[ar[pos]/2].erase(m[ar[pos]/2].begin());
            if(m[ar[pos/2]].size()>=2)
            {
                q.push(pos/2);
            }
        }
    }
    int c=0;
    for(int i=0;i<n;i++)
    {
        if(ar[i]!=-1)
        {
            c++;
            // cout<<ar[i]<<" ";
        }
    }
    cout<<c<<endl;
    for(int i=0;i<n;i++)
    {
        if(ar[i]!=-1)
        {
            cout<<ar[i]<<" ";
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
map<long long, set<long long> > m;
int main()
{
    // set<long long> s;
    // s.remove(5);
    int n;
    cin>>n;
    long long ar[n];
    for(int i=0;i<n;i++)
    {
        cin>>ar[i];
        m[ar[i]].insert(i);
    }
    int s=0;
    queue<long long> q;
    for(long long i=0;i<n;i++)
    {
        if(m[ar[i]].size() >= 2)
        {
            q.push(i);
        }
    }
    // //cout<<"here";
    while(!q.empty())
    {
        //cout<<"X: "<<i<<endl;
        int i = q.front();
        q.pop();
        if(m[ar[i]].size() >=2 && i == *m[ar[i]].begin())
        {
            set<long long>::iterator it = m[ar[i]].begin();
            long long pos = *(it);
            it++;
            long long pos2 = *(it);
            m[ar[i]].erase(m[ar[i]].begin());
            m[ar[i]].erase(it);

            ar[pos2]*=2;
            m[ar[pos2]].insert(pos2);

            if(m[ar[pos2]].size() >= 2)
            {
                q.push(*(m[ar[pos2]].begin()));
            }
            if(m[ar[pos]].size() >=2 )
            {
                q.push(*(m[ar[pos]].begin()));
            }
            ar[pos] = -1;
            //cout<<"Pos: "<<pos<<endl;
            // m[ar[i]].erase(m[ar[i]].begin());
            //cout<<ar[i]<<endl;
            // long long t=pos;
            // pos = *(m[ar[t]].begin());
            // if(m[ar[i]].size()>=2)
            // {
            //     q.push(i);
            // }

            // ar[t]=-1;
            //cout<<"Next: "<<pos<<endl;
            // ar[pos]*=2;
            // m[ar[pos]].insert(pos);
            // if(m[ar[i]].size()>=2)
            // {
            //     q.push(i);
            // }
            // m[ar[pos]/2].erase(m[ar[pos]/2].begin());
            // if(m[ar[pos]/2].size()>=2)
            // {
            //     q.push(pos);
            // }
        }
    }
    int c=0;
    for(int i=0;i<n;i++)
    {
        if(ar[i]!=-1)
        {
            c++;
            // cout<<ar[i]<<" ";
        }
    }
    cout<<c<<endl;
    for(int i=0;i<n;i++)
    {
        if(ar[i]!=-1)
        {
            cout<<ar[i]<<" ";
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
map<long long, set<long long> > m;
int main()
{
    // set<long long> s;
    // s.remove(5);
    int n;
    cin>>n;
    long long ar[n];
    for(int i=0;i<n;i++)
    {
        cin>>ar[i];
        m[ar[i]].insert(i);
    }
    int s=0;
    queue<long long> q;
    for(long long i=0;i<n;i++)
    {
        if(m[ar[i]].size() >= 2)
        {
            q.push(i);
        }
    }
    // //cout<<"here";
    while(!q.empty())
    {
        //cout<<"X: "<<i<<endl;
        int i = q.front();
        q.pop();
        if(ar[i]!=-1 && m[ar[i]].size() >=2)
        {
            long long pos = *(m[ar[i]].begin());
            //cout<<"Pos: "<<pos<<endl;
            m[ar[i]].erase(m[ar[i]].begin());
            //cout<<ar[i]<<endl;
            long long t=pos;
            pos = *(m[ar[t]].begin());
            ar[t]=-1;
            //cout<<"Next: "<<pos<<endl;
            ar[pos]*=2;
            m[ar[pos]].insert(pos);
            if(m[ar[pos]].size()>=2)
            {
                q.push(pos);
            }
            m[ar[pos]/2].erase(m[ar[pos]/2].begin());
        }
    }
    int c=0;
    for(int i=0;i<n;i++)
    {
        if(ar[i]!=-1)
        {
            c++;
            // cout<<ar[i]<<" ";
        }
    }
    cout<<c<<endl;
    for(int i=0;i<n;i++)
    {
        if(ar[i]!=-1)
        {
            cout<<ar[i]<<" ";
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
map<long long, set<long long> > m;
int main()
{
    // set<long long> s;
    // s.remove(5);
    int n;
    cin>>n;
    long long ar[n];
    for(int i=0;i<n;i++)
    {
        cin>>ar[i];
        m[ar[i]].insert(i);
    }
    int s=0;
    queue<long long> q;
    for(long long i=0;i<n;i++)
    {
        if(m[ar[i]].size() >= 2)
        {
            q.push(i);
        }
    }
    // //cout<<"here";
    while(!q.empty())
    {
        //cout<<"X: "<<i<<endl;
        int i = q.front();
        q.pop();
        if(ar[i]!=-1 && m[ar[i]].size() >=2)
        {
            long long pos = *(m[ar[i]].begin());
            //cout<<"Pos: "<<pos<<endl;
            m[ar[i]].erase(m[ar[i]].begin());
            //cout<<ar[i]<<endl;
            long long t=pos;
            pos = *(m[ar[t]].begin());
            if(m[ar[i]].size()>=2)
            {
                q.push(i);
            }

            ar[t]=-1;
            //cout<<"Next: "<<pos<<endl;
            ar[pos]*=2;
            m[ar[pos]].insert(pos);
            if(m[ar[i]].size()>=2)
            {
                q.push(i);
            }
            m[ar[pos]/2].erase(m[ar[pos]/2].begin());
            if(m[ar[pos]/2].size()>=2)
            {
                q.push(pos/2);
            }
        }
    }
    int c=0;
    for(int i=0;i<n;i++)
    {
        if(ar[i]!=-1)
        {
            c++;
            // cout<<ar[i]<<" ";
        }
    }
    cout<<c<<endl;
    for(int i=0;i<n;i++)
    {
        if(ar[i]!=-1)
        {
            cout<<ar[i]<<" ";
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
map<long long, set<long long> > m;
int main()
{
    // set<long long> s;
    // s.remove(5);
    int n;
    cin>>n;
    long long ar[n];
    for(int i=0;i<n;i++)
    {
        cin>>ar[i];
        m[ar[i]].insert(i);
    }
    int s=0;
    queue<int> q;
    for(int i=0;i<n;i++)
    {
        if(m[ar[i]].size() >= 0)
        {
            q.push(i);
        }
    }
    // //cout<<"here";
    while(!q.empty())
    {
        //cout<<"X: "<<i<<endl;
        int i = q.front();
        q.pop();
        if(ar[i]!=-1 && m[ar[i]].size() >=2)
        {
            long long pos = *(m[ar[i]].begin());
            //cout<<"Pos: "<<pos<<endl;
            m[ar[i]].erase(m[ar[i]].begin());
            //cout<<ar[i]<<endl;
            long long t=pos;
            pos = *(m[ar[t]].begin());
            ar[t]=-1;
            //cout<<"Next: "<<pos<<endl;
            ar[pos]*=2;
            m[ar[pos]].insert(pos);
            if(m[ar[pos]].size()>=2)
            {
                q.push(pos);
            }
            m[ar[pos]/2].erase(m[ar[pos]/2].begin());
        }
    }
    int c=0;
    for(int i=0;i<n;i++)
    {
        if(ar[i]!=-1)
        {
            c++;
            // cout<<ar[i]<<" ";
        }
    }
    cout<<c<<endl;
    for(int i=0;i<n;i++)
    {
        if(ar[i]!=-1)
        {
            cout<<ar[i]<<" ";
        }
    }
}