t = gets.to_i
tres = []
t.times do
  g = gets.split.map(&:to_i)
  p = gets.to_i
  m = Array.new(p).map{Array.new(4)}
  p.times do |j|
    m[j] = gets.split.map(&:to_i)
  end


  pm = Array.new(g[0] + 1).map{Array.new(g[1] + 1, 0)}
  p.times do |j|
    tx = [m[j][0], m[j][2]].max
    ty = [m[j][1], m[j][3]].max
    if m[j][0] == m[j][2]
      if pm[tx][ty] == 1 || pm[tx][ty] == 3
        pm[tx][ty] = 3
      else
        pm[tx][ty] = 2
      end
    elsif m[j][1] == m[j][3]
      if pm[tx][ty] == 2 || pm[tx][ty] == 3
        pm[tx][ty] = 3
      else
        pm[tx][ty] = 1
      end
    end
  end

  res = Array.new(g[0] + 1).map{Array.new(g[1] + 1, 0)}

  for i in (0..g[0]) do
    for j in (0..g[1]) do
      if i == 0 && j == 0
        res[i][j] = 1
      else
        if j != 0 && (pm[i][j] != 2 && pm[i][j] != 3)
          res[i][j] += res[i][j - 1]
        end
        if i != 0 && (pm[i][j] != 1 && pm[i][j] != 3)
          res[i][j] += res[i - 1][j]
        end
      end
    end
  end

  res = res[g[0]][g[1]]
  puts (res.zero? ? "Miserable Hokusai!" : res)
  tres << res


end

p tres