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){Array.new(gx)}
  ptn[0][0] = 1
  
  for y in 0..gy-1
    for x in 0..gx-1
      if x!=0 && y!=0
        ptn[y][x] = ((x==0||ng.include?("#{x-1} #{y} #{x} #{y}")) ? 0 : ptn[0][x-1])+((y==0||ng.include?("#{x} #{y-1} #{x} #{y}")) ? 0 : ptn[y-1][0])
      end
    end
  end
  
  if ptn[-1][-1] == 0
    puts "Miserable Hokusai!"
  else
    puts ptn[-1][-1]
  end
end