H,W = map(int,raw_input().split()) N = int(raw_input()) SK = [raw_input().split() for i in xrange(N)]