# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2186
# ????£????20??????????????????
# ??????????????§??????
# ???????°????????????§????¬??????????????????????

def make1d(n)
  a = Array.new(n)
  for i in 0..(n-1)
    a[i] = 0
  end
  a
end
def make2d(height,width)
  a = Array.new(height)
  for i in 0..(height-1)
    a[i] = make1d(width)
  end
  a
end

dataset = gets.to_i
dataset.times {
	gx, gy = gets.split(" ").map(&:to_i)
	gx, gy = gx+1, gy+1 
	#p [gx,gy]
	matatabi = gets.to_i
	# ???????????§????????° p ????????£?????????????????¨?????????????????? p ??¨??????????????????
	mat = {}
	(0..matatabi-1).each{|i|
		x1,y1, x2,y2= gets.split(" ").map(&:to_i)
		x1,y1, x2,y2= x1+1,y1+1, x2+1,y2+1
		ue_or_hidari = x2-x1==0 ? 1 : 2 #?????????1, ?????????2??¨??????
		mat[x2.to_s+' '+y2.to_s] = (mat[x2.to_s+' '+y2.to_s] || 0)+ue_or_hidari
	}
	# ????????????array??????????????´????????????????????????????????¨??§???array[-1]??§??¨??????????????????????????????????????????
	array = make2d(gx+1,gy+1)
	array[1][1]=1
	x,y = 1,1
	(1..gx).each do |x|
		(1..gy).each do |y|
			unless x==1 && y==1
				if mat[x.to_s+' '+y.to_s] == nil
					array[x][y] = array[x-1][y]+array[x][y-1]
				elsif mat[x.to_s+' '+y.to_s] == 1
					array[x][y] = array[x-1][y]
				elsif mat[x.to_s+' '+y.to_s] == 2
					array[x][y] = array[x][y-1]
				elsif mat[x.to_s+' '+y.to_s] == 3
					array[x][y] = 0
				end
			end
		end
	end
	if array[gx][gy]==0
		p 'Miserable Hokusai!'
	else
		p array[gx][gy]
	end
}