def f(x, y)
  $memo[x][y] = f(x - 1, y) + f(x, y - 1) unless $memo[x][y]
  return $memo[x][y]
end
def main(input = STDIN)
  while (a, b = input.gets.split(" ").map(&:to_i)) != [0, 0]
    $memo = Array.new(a){Array.new(b)}
    (0...a).each{|i|$memo[i][0] = 1}
    (0...b).each{|i|$memo[0][i] = 1}
    input.gets.to_i.times do
      x, y = input.gets.split(" ").map(&:to_i)
      $memo[x - 1][y - 1] = 0
    end
    puts $memo.map{|a|a.map(&:to_i).join(" ")}
  end
end
main