#include using namespace std; #define rep(i,n) for (int i = 0; i < n; ++i) using ll = long long; using P = pair; int main() { ll W,H,N;cin>>W>>H>>N; set mark,num; rep(i,N){ ll Si,Ki;cin>>Si>>Ki; mark.insert(Si); num.insert(Ki); } cout<