#include #define rep(i,n) for(int i=0;i<(int)(n);i++) #define rep1(i,n) for(int i=1;i<=(int)(n);i++) #define all(c) c.begin(),c.end() #define pb push_back #define fs first #define sc second #define show(x) cout << #x << " = " << x << endl #define chmin(x,y) x=min(x,y) #define chmax(x,y) x=max(x,y) using namespace std; typedef long long ll; set as,bs; int main(){ int H,W,N; cin>>H>>W>>N; rep(i,N){ int a,b; cin>>a>>b; as.insert(a); bs.insert(b); } ll X=as.size(),Y=bs.size(); cout<