def main(): H, W = map(int, raw_input().split()) N = input() H, W = H-1, W-1 S = [] K = [] c = 0 while c