import sys input = sys.stdin.readline H,W,Q=map(int,input().split()) D=dict() MINUS=0 for i in range(Q): y,x=map(int,input().split()) if x in D: if y