#include<bits/stdc++.h>
using namespace std;
int n,m,q,x,y,temp;
int* daha;
int& dahaNa(int x,int y){
    return data[x+y*n];
}
int main(){
    cin>>n>>m;
    daha=new int[n*m];
    cin>>q;
    while(q--){
        cin>>x>>y;
        temp=dahaNa(x,y);
        dahaNa(x,y)=INT_MAX;
        dataNa(x,y)=temp;
    }
    return 0;
}