gets.to_i.times do
  gx,gy = gets.split(" ").map{|s| s.to_i}
  ng = Array.new(gets.to_i){gets.chomp}
  ptn = Array.new(gy+1){Array.new(gx+1)}
  ptn[0][0] = 1
  
  for x in 1..gx
    ptn[0][x] = (ng.include?("#{x-1} 0 #{x} 0") ? 0 : ptn[0][x-1])
  end
  for y in 1..gy
    ptn[y][0] = (ng.include?("0 #{y-1} 0 #{y}") ? 0 : ptn[y-1][0])
    for x in 1..gx-1
      ptn[y][x] = (ng.include?("#{x-1} #{y} #{x} #{y}") ? 0 : ptn[y][x-1]) + (ng.include?("#{x} #{y-1} #{x} #{y}") ? 0 : ptn[y-1][x])
    end
  end

  puts (ptn[-1][-1] == 0 ? "Miserable Hokusai!" : ptn[-1][-1])
end